menu_breadcrumb sets drupal_set_breadcrumb within hook_init. uc_catalog fires drupal_set_breadcrumb at hook_nodeapi. Altering the module weight for menu_breadcrumb has no effect, because hook_init always fires before hand. This patch sets the breadcrumb at the last possible level, before node view, to give it the capacity to be the last/heaviest (highest precedence) influence on the breadcrumb.

Files: 
CommentFileSizeAuthor
breadcrumb_respect_weight.patch627 bytesiankp

Comments

Title:Breadcrumb fires at init, doesn't display/gets overwritten by Ubercart catalog.Breadcrumb fires at init, doesn't display/gets overwritten by Ubercart catalog, and potentially others. (patch included)
Status:Active» Needs review

Reading other tickets I noticed that logic in hook_init() seemed to be a source of other problems and thought perhaps my patch could be a fix for other issues. My change simply defers breadcrumb generation (more specifically, output) to a place that will both respect module weights and not be so easily/commonly overwritten by other modules. I considered why the entire _init logic wasn't simply in _nodeapi, and it became clear to me that this (including my patch) causes a limitation in which only nodes will receive a breadcrumb. _init must be being used to target any and all areas including administration pages, et cetera. The real question then arises, can we defer the output to all the places it needs to be (and what are those places exactly?) without the apparently somewhat problematic shotgun approach of hook_init() ?

I just applied the patch on the newest dev version and got the following error when visiting /admin/settings/menu_breadcrumb:

call_user_func_array() [<a href='function.call-user-func-array'>function.call-user-func-array</a>]: First argument is expected to be a valid callback, 'menu_breadcrumb_admin_settings_form' was given in /home/giantbal/public_html/includes/form.inc on line 382.

There were no errors while applying the patch, just afterwords. Any ideas?

Thanks much for working on this awesome module!

Status:Needs review» Needs work

Changing Status due to problem report in #3.

Note #1827248: Release co-ordination for Menu Breadcrumb 6.x-1.4 and 7.x-1.4 - if you want this fixed in the next release, now's the time to make it happen.