[development] breadcrumb override problem

Augustin (Beginner) drupal.beginner at wechange.org
Sun Jun 29 08:28:46 UTC 2008


Hello,


I'm upgrading and cleaning directory.module for Drupal 6.
I am running on a breadcrumb problem.

I think the Drupal core implementation of breadcrumbs is broken. 
First of all, there can only be one set of breadcrumbs.
Imagine a blog post outlined in some book, with a few taxonomy terms.
We potentially have three sets of breadcrumbs: the one set by each 
module involved (blog, book, taxononomy, though core taxonomy.module 
doesn't set the breadcrumbs on a node view.) 

To decide which breadcrumb will prevail, timing is everything: it will 
be the one set by the last call of drupal_set_breadcrumb() BEFORE the 
first call of drupal_get_breadcrumb(). 

I was trying to override the taxonomy.module's breadcrumbs on a 
taxonomy/term/nnn page, but:
- if I call drupal_set_breadcrumb() from hook_help(), it's too late: 
the theming engine has already called drupal_get_breadcrumb() and my 
breadcrumbs are ignored.
- if I call drupal_set_breadcrumb() from hook_init(), it's too early:
taxonomy.module will override mine just before drupal_get_breadcrumb() 
gets called!

So, now, I am a bit lost and don't know where I can best call 
drupal_set_breadcrumb() so that it comes after taxonomy's call, and 
before the first drupal_get_breadcrumb() call...

Searching d.o, I've found many other issues in other crontrib modules 
which seem to deal with more or less the same problem, but I've not 
found a solution yet.


So:

1) how should I solve my particular problem (the timing of 
drupal_set_breadcrumb() in my module to override/enhance taxonomy's 
breadcrumbs). 

2) Do you agree that Drupal's core breadcrumbs handling could be 
improved, to make it possible to have several sets of breadcrumbs 
(why not? A good themer could accommodate them easily), or at least 
to make it easier to override / complement each other's breadcrumbs.


If there's some kind of agreement on the second point, I'll open an 
issue for D7 with a summary of the discussion here.


Blessings,

Augustin.





-- 



More information about the development mailing list