Skip to content
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

ENH Keep state in Page's Breadcrumbs #2753

Conversation

sabina-talipova
Copy link
Contributor

@sabina-talipova sabina-talipova commented Jul 25, 2022

Description

  • Additional get parameters in Breadcrumbs links

Parent issue

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think we need this PR

Comment on lines +1095 to +1099
: Controller::join_links(
$ancestor->CMSEditLink(),
'?' . http_build_query($params ?? [])
)
]));
Copy link
Member

@GuySartorelli GuySartorelli Jul 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want this - we probably only want this on the "back" button in the breadcrumb rather than each link. That's handled in GridFieldDetailForm_ItemRequest::getBackLink().

If we do want this to apply to each link, we should do this from the GridFieldDetailForm_ItemRequest::Breadcrumbs() method. This already has a list of all of the breadcrumbs ($items = $this->popupController->Breadcrumbs($unlinked);) which we can loop through like this:

foreach ($items as $item) {
    if ($item->Link) {
        $item->Link = $this->gridField->addOtherGridfieldStateToURL($item->Link);
    }
}

That way we only have this in the context of a gridfield, instead of arbitrarily adding all params to every breadcrumb.

@sabina-talipova sabina-talipova deleted the pulls/4.11/gridfield-keep-state branch July 26, 2022 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants