Problem/Motivation
The current implementation for "field_slideshow_inherit" assumes, that children entities of the selected menu items are having real menu entries.
In certain cases this might not be true and the trail is just created by path (e.g. using https://www.drupal.org/project/menu_trail_by_path) or the submenu items are disabled to not show them in the navigation.
A further problem is, that the current implementation doesn't seem to work if the sub-item is a taxonomy term and not a node. Even when using taxonomy menu to create real (and active) menu items for the children menu items, the parent is not detected.
Steps to reproduce
Good examples can be found at DD customer project, for example:
- "News" nodes (no menu item, but below the news menu item, which has field_slideshow_inherit for children enabled and the breadcrumb trail shows the news nodes as children
- Distr. Downloads are taxonomy terms with active menu items and should inherit their parent menu item slideshow, but does not work. As a workaround we're using a separate view for now.
Proposed resolution
Don't assume real menu items, instead use the breadcrumb trails links to traverse up, if possible.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork drowl_header_slides-3309682
Show commands
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:
- 3309682-detect-parent-menu-items-by-trail
changes, plain diff MR !8
- 4.x
changes, plain diff MR !7
Comments
Comment #2
anybodyThis should be VERY helpful: https://atendesigngroup.com/articles/drupal-8-menu-system-generate-previ...
And sadly shows, that it's a bit of a mess to get the parent active trail parent(s).
Comment #3
anybodyMarking this as bug, as it didn't work as expected yet.
Comment #7
anybodyHere we go finally. Detecting parent menu item header slideshows no works based on the active trail :party:!!
Still it doesn't work for the special case of taxonomy_menu items, as they use a different plugin, but that should be part of a minor follow-up.
Comment #9
anybody