- last update
11 months ago 88 pass - last update
11 months ago 79 pass, 14 fail - last update
9 months ago 88 pass - last update
9 months ago 88 pass - 🇺🇸United States jghyde
#12 works with D9.3.22. It also solved my page_manager problem related to contexts and controllers matching.
- 🇺🇸United States jghyde
When upgrading from 9.1.2 to 9.3.22 received this error caused by page_manager when attempting
drush updb
.PHP Fatal error: Declaration of Drupal\page_manager\Entity\Page::getContexts() must be compatible with Drupal\page_manager\PageInterface::getContexts
Applying this patch at #17 solved the issue.
(I am in Drupal upgrade prison with a large site. Hopefully this will get indexed into Google and help any others in same boat).
- 🇩🇪Germany Hydra
We first used this patch as well and it seemed to fix our problem. But manipulating the request this way will lead to a loss of information on the route in some circumstances which will result in other, unfixable issues.
For us the solution was to use page managers PAGE_CONTEXT Event to add our missing context which looked kinda like this for our missing group context:
public function onPageManagerPageContext(PageManagerContextEvent $event) { $page = $event->getPage(); foreach ($page->getContexts() as $context) { if (!$context->hasContextValue()) { $context_definition = $context->getContextDefinition(); if ($context_definition->getDataType() == 'entity:group') { // Tell page_manager about our context value. $page->addContext('group', new Context($context_definition, $this->getGroupFromRoute())); } } } }
- 🇩🇪Germany geek-merlin Freiburg, Germany
@Hydra #20:
> But manipulating the request this way will lead to a loss of information on the route in some circumstances which will result in other, unfixable issues.This is a bit foggy and not productive in getting this further. Can you elaborate?
- Status changed to Needs work
5 months ago 11:10am 20 January 2024 - 🇩🇪Germany geek-merlin Freiburg, Germany
Patch #17 applies cleanly on current core 10.2.2 and fixes the issue for me.
Code looks good and reasonable, and i can not see or guess what the #20 objection may mean.
(#17 manipulates a separate request and pushes / pops it onto the stack.)This fix MAY be affected by the related long-standing core issue though.
So if people experience new problems with this patch, imho they should try applying the other too and report back.Setting NW for an automated test, which might look like this:
- Create a page with a context, use the context to control page access
- Create a $url for that page and call $url->access() - 🇩🇪Germany Hydra
@geek-merlin - it's a while ago I faced this issue. But as far as I can remember (and my git history tells me) we had a local task (tab) added to the group tasks which pointed to a page_manager page route. That page of course has the group context configured and used a custom condition plugin to determine the access. That condition used the group context to check for some information related to the group in order to grant or deny access. In combination with this patch, this resulted in an error on the local task access check level - kinda related to what berdir described what could happen to menu links in #5
Removing the patch and adding the event subscriber with the provided code in #20 solved that for us and solved the original issue we used the patch for in the first place. - last update
3 months ago 78 pass, 4 fail - 🇩🇪Germany geek-merlin Freiburg, Germany
#23: Thanks. Nothing that can be reproduced though.
- 🇩🇪Germany geek-merlin Freiburg, Germany
Looked a bit deeper into this and found that the logic of #17 is not enough in many cases.
Rolled a MR that is way more robust and fixes the issue for me. Still needs tests though.