-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fix drupal_set_title() changing breadcrumb titles #100
Conversation
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.
What's a way to reproduce this? I wonder if we could make RetrofitTitleResolver
aware of the RequestStack
instead. Then we can use SplObjectStorage
to store the title based on objects.
That is how we handled it in Commerce for request-specific things https://git.drupalcode.org/project/commerce/-/blob/8.x-2.x/modules/store/src/CurrentStore.php?ref_type=heads
I experienced this with Ctools on export UI page callbacks. Each callback ran drupal_set_title(), so when the breadcrumb was generated every link had the same title. Object storage sounds good, but I don't know what RequestStack is. |
The RequestStack is how |
ef55f74
to
94f2b2d
Compare
94f2b2d
to
7c2503b
Compare
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.
Looks great!
$requestStack = $this->container->get('request_stack'); | ||
assert($requestStack instanceof RequestStack); | ||
$request = $requestStack->getCurrentRequest(); | ||
assert($request instanceof Request); |
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.
Huh, I'm surprised this works without pushing a request to the stack.
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.
I found that pathInfo
is not set when a request is created, so it never matched the request from the request stack.
No description provided.