Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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);
Thanks to that alter function, we can make breadcrumb construction more flexible. I make a patch to show you how you could use it.
The advantages of this method is that another modules can complete breadcrumb links before links are generated and so add attributes, html or anything they want.
I make also possible to preprocess node->title and make taxonomy_breadcrumb compatible with taxonomy/term/% view.
Comment | File | Size | Author |
---|---|---|---|
#1 | 1364914-use-drupal-alter-menu-breadcrumb-1.patch | 6.46 KB | GoZ |
Comments
Comment #1
GoZ CreditAttribution: GoZ commentedHere is the patch to read my code
Comment #2
LonitaD CreditAttribution: LonitaD commentedThis patch was throwing a non-object error on the taxonomy/term/%/edit page. When on the edit page, $page_term->tid is an object instead of just a value like on the taxonomy/term/% pages. I changed
to
If there is a better way to fix it, please let me know.
Comment #3
jantoine CreditAttribution: jantoine commentedWe can revisit this issue once 7.x-1.0 is released, but not before than!