Closed (fixed)
Project:
Tour
Version:
2.0.x-dev
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Oct 2025 at 10:46 UTC
Updated:
5 Dec 2025 at 16:04 UTC
Jump to comment: Most recent
Currently, if the "bundle" parameter is used as a route parameter inside a tour, it can only be used on nodes.
See line 134-142 inside "TourHelper":
case 'bundle':
case 'node_type':
if (($entity = $route_match->getParameter('node')) && ($entity instanceof EntityInterface)) {
if ($entity->bundle() === $tour_param) {
// Add the node type (bundle) as comparable parameter.
$params['bundle'] = $entity->bundle();
}
}
break;
Use a non node type as the bundle key. E.g.:
route_name: entity.taxonomy_term.edit_form
route_params:
bundle: tags
See it not working.
Find a way to get the entity from the "$route_match" or some other way, without passing an actual parameter, or use a dynamic parameter that fits the current entity type?
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
anybodyThis is indeed unexpected and confusing. I think you would either expect
bundle:to work for any entity types, not only nodes (that would be best and should also be bw-compatible).The harder part is this line:
with hard-coded
"node"!See this discussion and suggestions for this general problem:
https://www.drupal.org/forum/support/module-development-and-code-questio...
Maybe we could use one of the ways shown there or this might even need a Drupal Core API helper?
Comment #4
anybodyLet's see, if this works...
Comment #5
anybodyNice, it works and fixed the failing test! Still please review carefully if it all makes sense.
Was more kind of trying if this may work...
Comment #7
smustgrave commentedmade a tweak where I just combined the case 'node_type' with the node and taxonomy. Locally the test still passes. Did this because not a fan of a switch case without a break :)
Comment #8
smustgrave commentedany objections to these changes? I can merge
Comment #9
anybody@smustgrave I left a comment. I'd expect this to break things. To be totally sure, we'd need more test coverage for all the cases where these switch cases are used (if even possible and not unreachable code)
Comment #10
smustgrave commentedSo added a check if node_type then change key to node that work ?
Comment #11
grevil commentedNice! Works as expected! RTBC!
Comment #13
smustgrave commented