Currently, there is no way to alter the parent candidates that menu_trail_by_path uses to build the breadcrumb. It would be ideal if these could be altered by other modules to customize menu_trail_by_paths behavior for advanced usages.

Patch coming.

Comments

lee20’s picture

Attached is a patch which adds a call to drupal_alter in _menu_trail_by_path_get_parent_candidates()

a.milkovsky’s picture

Status: Active » Needs work

Good idea. You should also provide hook_menu_trail_by_path_parent_candidates_alter() documentation in menu_trail_by_path.api.php file.
P.S. I would also provide a setting or hook to menus, which should work with menu_trail_by_path. but it's other issue.

a.milkovsky’s picture

Status: Needs work » Needs review
StatusFileSize
new1.18 KB

See the patch.

a.milkovsky’s picture

See the patch.

fago’s picture

Status: Needs review » Needs work

Makes a lot of sense. Not sure about the naming/docs though - what does it mean to alter parent candidates? Does it change parents?

a.milkovsky’s picture

Status: Needs work » Needs review

Yep, for me name "parent candidates" is also not obvious.
The module looks at the current menu path and explodes it by slash. Than it looks for alias to each path part.
In the module the result is called "an array of parent candidates".

Example: for path 'foo/bar/zee'
It will return array of internal Drupal paths for 'foo', 'foo/bar', 'foo/bar/zee'

sill’s picture

Status: Needs review » Reviewed & tested by the community

Patch from #4 works great! Thanks!

Can we get this committed to dev! Great module, minor feature addition to make it super rad!

srclarkx’s picture

I used this patch to keep the first parent candidate from being selected rather than the last candidate. The module messed up navigation highlighting for one section of the site. The patch is great.

I used this patch over, https://www.drupal.org/node/2413925, because most of the navigation highlighting was working fine.

davy-r’s picture

Status: Reviewed & tested by the community » Needs review

triggering automated testing

  • davy-r committed 868b11f on 7.x-2.x
    Issue #2303693 by a.milkovsky, lee20: Allow other modules to alter...
davy-r’s picture

Status: Needs review » Fixed

Thanks for contributing

  • davy-r committed 868b11f on 7.x-3.x
    Issue #2303693 by a.milkovsky, lee20: Allow other modules to alter...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.