-
-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.x] Add filters from collection/taxonomy list to breadcrumb back link #11243
[5.x] Add filters from collection/taxonomy list to breadcrumb back link #11243
Conversation
Do you have a specific reason that you made it opt-in with a config? I don't really see a reason someone wouldn't want it. |
No specific reason @jasonvarga, I just didn’t want to change a default behavior, that’s all :)
Yes, you’re right, me neither. Should I remove the opt-in? |
I appreciate that 😄 Yeah, let's remove the opt-in. |
Removed the opt-in and made a change to also add the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please give me permission to push to your branch? Usually it would auto-close the PR if your branch doesn't give us permission. Weird. 🤔
Or, please make the following change yourself:
- Remove additions to Breadcrumbs.php
- Change the
breadcrumbUrl
methods to the following.
public function breadcrumbUrl()
{
$referer = request()->header('referer');
$showUrl = $this->showUrl();
return $referer && Str::before($referer, '?') === $showUrl ? $referer : $showUrl;
}
This would just check that the refererer is the showUrl. If it is, use all the query parameters as-is.
This seems much simpler, but maybe you can see a reason for needing to do what you originally did.
@jasonvarga I made the changes |
I got the request from a client if it’s possible to change the link that points back to the collection list from the edit view, so that it includes search/filter/sort params that were set before the user entered the single view from the list. I found a corresponding feature request in statamic/ideas statamic/ideas#1049, and this PR aims to add that functionality that can be enabled via a config key.
I’m not sure if that is the best place for the config key (and if the name is clear enough), and if it’s a good idea to extend the
Breadcrumbs
class, but I couldn’t fint another place where the method could go. Thought about adding a Trait, but left it this way for now.