Discovered while trying to use Menu Position with Special Menu Items, the breadcrumb trail does not get set because Special Menu Items calls drupal_get_breadcrumb() and drupal_set_breadcrumb() in hook_init(). This causes the 'menu_set_active_trail' and 'drupal_set_breadcrumb' static caches to be initialised too early for menu_position_activate_rule() to have any effect.

The attached patch fixes this by explicitly resetting these static caches when setting breadcrumbs. This could perhaps be considered a bug in Special Menu Items, but I suspect other breadcrumb related modules may cause the same problem.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mp165’s picture

thanks @longwave - exactly what i needed!

ressa’s picture

@longwave, great work! I am using Menu Position with Menu Breadcrumb, and the breadcrumb wouldn't show up, but the patch made it appear. Without the title, though, even though I have 'Append page title to breadcrumb' selected in Menu Breadcrumb settings. But I have a breadcrumb and that's what counts.

Wolfgang Reszel’s picture

Thanks, this patch helps with Menu Breadcrumb. As I add the page title through the theme (Zentropy) it works perfect.

mansspams’s picture

Patch works, but Menu Breadcrumb cannot add page title. Can something be done about it in Menu Breadcrumb module? I also tried to edit module weights, but that does not help.

Erik Seifert’s picture

Work also for panel paths like 'node/%node/article'

Rob_Feature’s picture

Status: Needs review » Reviewed & tested by the community

Yup, works for me with menu breadcrumbs as well. Marking "reviewed and tested" since it seems like we've got a few folks reporting success.

rattusrattus’s picture

Patch updated to use paths relative to the module directory. Great work on this one, just what I needed.

Ludo.R’s picture

Changing modules weight has no effect because of this :

/**
 * Implements hook_page_delivery_callback_alter().
 *
 * This is the only hook that occurs after the page callback, but before
 * hook_page_build (when blocks are added). We're using this hook for its
 * timing, not its data.
 */
function menu_position_page_delivery_callback_alter() {
  //...
}

Perhaps menu_position should give a chance to other modules to alter the breadcrumb (like adding the current page title).
This could be done inside this function, by adding a drupal_alter() before setting active trail :

function menu_position_activate_rule($rule, $context, $set_breadcrumb) {
  //...
    drupal_alter('menu_position_active_trail', $active_trail, $context);
    menu_set_active_trail($active_trail);
  }

  return TRUE;
}

However, should menu_position prevail over all other breadcrumb related modules?
Using menu_position makes all other modules useless.

harrrrrrr’s picture

The patch in #7 works fine for me. (I have no problem with the title, it's added to the bc trail)

ckrina’s picture

Patch in #7 works for me using Panels and solves my problem in this context.

rv0’s picture

Priority: Normal » Major

Patch in #7 works for me

Upping priority as the patch is 5 months old.

Fabianx’s picture

+1 for RTBC (using this in production)

Please lets get #7 in.

#8: An alter hook is a nice idea.

Overriding other modules is no problem, because you can select _when_ to apply menu position rules. Want another module? Just don't use mpr on this path.

vlad.dancer’s picture

+1 for #7. Work for me too

Sborsody’s picture

The patch in #7 solved an issue of the breadcrumb not appearing in a panel. Yay!

dabblela’s picture

Patch in #7 had whitespace issues for me. Re-rolled.

dabblela’s picture

Sorry, path issues in that one.

Heorhi Lazarevich’s picture

Patch in #7 works for me using Adaptive Theme with options "Append the page title to the breadcrumb trail" enabled. Without this patch only page title was showing in the breadcrumbs without menu trail.

troybthompson’s picture

Issue summary: View changes

#16 solved the problem for me.

peterlolty’s picture

Priority: Major » Critical
Alan D.’s picture

Yep, another rtbtc by me :)

Mine broke when using special menu items which was setting the trail.

Normally, I would not consider this a critical priority issue as there are not any wsod (white screens of death) or data loss. But this is really major as it is not actually working without it!

troybthompson’s picture

Solved my problem as well.

jhedstrom’s picture

Another RTBC here. Fixes the conflict with items nested under a special menu item.

kbentham’s picture

RTBC here as well. This fixed my breadcrumb issues.

bryanhirsch’s picture

RTBC, resolves my issues.

Agogo’s picture

#16 fixed my problem with the breadcrumb as well. Someone please commit this.

peterlolty’s picture

RTBC, resolves my issues. thanks.

akalata’s picture

RTBC bump :)

schwarli4783’s picture

#16 solved the problem for me.

jenlampton’s picture

#16 works for me to, +1 on RTBC

Rob_Feature’s picture

Um. "Me Too". This has been an issue forever...Would LOVE to see this committed!!!!

alexanansi’s picture

Not using special menu items, but whatever what was causing the problem was fixed by this patch

BarisW’s picture

RTBC-ed 3 years ago. Patch fixes the issue for a lot of people. Can this please be committed?
I'm happy to become co-maintainer if time is the issue here.

vood002’s picture

Thank you! #16 solved my problems

peterlolty’s picture

This is already set to critical, so hope the maintainer look at here soon.

ps. RTBC is for #16

  • BarisW committed a52c698 on 7.x-1.x authored by longwave
    Issue #1461384 by manatwo, longwave, ratface: Breadcrumb trail not...
BarisW’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 7.x-1.x-dev. Thanks all!

Status: Fixed » Closed (fixed)

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