Use drupal_alter('menu_breadcrumb') instead of set new active trail

Created on 8 December 2011, over 13 years ago
Updated 29 March 2024, about 1 year ago

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)

โœจ Feature request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

๐Ÿ‡ซ๐Ÿ‡ทFrance goz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand xurizaemon ลŒtepoti, Aotearoa ๐Ÿ

    Closing a lot of ancient (> 4 years) issues. It's fine to re-open if you think there's something of value to be discussed.

Production build 0.71.5 2024