I'm creating a menu that links to taxonomy terms. Those links are saved pointing to the default taxonomy term route name.
The way page manager works now, the route name that is actually used on a given request might however be a completely different one.
The result is that MenuActiveTrail::getActiveLinks() doesn't find any links for the actual route name and the active trail doesn't work.
I have no idea how to fix this.
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | 2634276-pm-19.patch | 2.65 KB | tim.plunkett |
| #19 | interdiff.txt | 2.2 KB | tim.plunkett |
| #16 | multiple_routes_break-2634276-16.patch | 2.67 KB | jibla |
Comments
Comment #2
dawehnerurgs
Comment #3
tim.plunkettOuch.
So the route object does contain the correct/expected route name. See this code from RouteNameResponseSubscriber:
$route_name = $this->routeMatch->getParameter('base_route_name') ?: $this->routeMatch->getRouteName();Perhaps we could trick everything into thinking it's actually that route name?
Comment #4
m.abdulqader commentedThe issue of base route name almost break every thing related to node route.
Here is the list of things I did work a round solution to solve:
This issue should be considered as Critical.
Regards
Comment #5
m.abdulqader commentedHello All,
I have a question, Is creating a page manager active menu trail that extend the default class, one of the solution or you have another solution in mind.
Comment #6
tim.plunkettComment #7
tim.plunkettComment #8
george.karaivanov commentedHi.
The problem still exists for all entities. I found why ActiveMenuTrail doesn't work if we override node view and have more than one variant.
If panel page has more than one variant then panels manager add variant_id to route name. Class PageManagerRoutes:
And when we are on page /node/123 our 'route_name' is 'entity.node.canonical_' . variant_id instead of 'entity.node.canonical'.
That's why MenuActiveTrail will not be set, because in the table 'menu_tree' route_name is 'entity.node.canonical'
Comment #9
jibla commentedHello,
I think my patch solves these issues. I have done changes to VariantRouteFilter.php, which implements RouteFilterInterface. Idea is to once again iterate over routes $collection, and make sure that final route object's name in collection matches its original base_route_name, which btw is preserved in alterRoutes() when creating them. We can see the comments there, which says that base_route_name was added as a parameter exactly for that case when we have multiple routes for multiple variants.
P.S. after you apply patch, you have to clear cache to force routes cache re-generate.
Comment #10
jibla commentedComment #11
bircherThe patch cures the symptoms observed in #2649702
Comment #12
tim.plunkettThis needs test coverage, and also does not follow Drupal's coding standards.
Comment #13
tim.plunkettAlso, I'm worried this will change the order in some cases.
Comment #14
jibla commentedUploading updated patch. It passes drupal coding standards.
Comment #15
tim.plunkettCode comments should reflect the code as it is, not in relation to how broken it used to be.
"Idea is" is not a valid beginning to an English sentence. And "btw" isn't a word.
Also this paragraph isn't wrapped properly to 80 characters.
Still needs tests and needs to preserve the order of the collection.
Comment #16
jibla commentedUpdated patch file.
Comment #17
jibla commentedComment #19
tim.plunkettThis still needs integration tests for something like active trail or whatever else was broken, not just a unit test.
Fixed the unit test, simplified the logic of the loop, and rewrote the docs.
Comment #20
fran seva commentedHi @all -- I started to work in the test but when I tried to reproduce the error (manually) overriding node/{node} page and adding 2 variants I couldn't reproduce the error.
Could someone clarify the steps to reproduce the error?
Thanks!
Comment #21
hkirsman commentedLast patch fixes the tab issue: https://www.drupal.org/node/2649702
Comment #22
hkirsman commentedfran seva, I understand that only the first variant works. Did you check both? Mine had 3 variants and the second one didn't work (but I didn't test the others).
Comment #23
kiwad commentedI use the patch from #19 to show a menu block in a left column. It works.
But if I add a block "Page title (core)" in my Panel variant, the output of the block is empty(edit : not related...)Comment #24
japerrySlightly related -- taxonomy term view pages with core conflicts with page manager overrides if you use the same route.
Comment #25
youfei.sun commentedFixed my issue of showing admin tabs only on first varient.
Comment #26
AndersNielsen commentedTested #19, fixed the issue for me. Thumbsup :)
Comment #27
tim.plunkettHad to absorb this into #2736385: Page Manager routing is overly complex and brittle: breaks REST, active trail, fallback pages. Not closing this yet, but please try that patch out.
Comment #28
tim.plunkettThis has now been fixed by #2736385: Page Manager routing is overly complex and brittle: breaks REST, active trail, fallback pages