Posted by GoZ on December 8, 2011 at 9:30am
2 followers
Jump to:
| Project: | Menu Breadcrumb |
| Version: | 7.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
i read your module and try to understand how it works. If i'm not wrong
at hook_init you get menu_breadcrumb preferences to know which menu or regexp to use for build breadcrumb
you set active trail to this menu <-- here is the bad things for me (on D7)
you call drupal_get_breadcrumb() which call menu_get_active_breadcrumb() which build breadcrumb based on active_trail
With D7, there is a new function :
// Allow modules to alter the breadcrumb, if possible, as that is much
// faster than rebuilding an entirely new active trail.
drupal_alter('menu_breadcrumb', $active_trail, $item);So i think you doesn't have to rebuild breadcrumb in hook_init but use hook_menu_breadcrumb_alter($active_trail, $item) to build your clean new breadcrumb.
You still could add current page (with or without link) to breadcrumb with a hook_preprocess_breadcrumb(&$variables)
Comments
#1
+1 for this.
If I want to alter some breadcrumbs I can normally use hook_menu_breadcrumb_alter(), however because this module is using drupal_set_breadcrumb() this is no longer possible.
An alternative could be to add an alter hook that runs just before drupal_set_breadcrumb() but it seems more logical to use hook_menu_breadcrumb_alter() in the first place.