in trying to get http://drupal.org/node/96971 working ("make better use of tabs and subtabs on project nodes") i ran into all sorts of problems trying to get tabs and breadcrumbs to interact nicely with each other. eaton and morbus pointed me to drupal_set_breadcrumb()
which works much better. ;) to avoid hurting myself in other places, i'm planning to remove the few uses of menu_set_location()
and convert everything to use drupal_set_breadcrumb
. sadly, the format of the arrays they expect is different, which is why i'm just converting everything and keeping things consistent.
also, l()
does the check_plain()
on the title of the link for us, so fear not the raw usage of $node->title
, etc.
Comment | File | Size | Author |
---|---|---|---|
#1 | project_drupal_set_breadcrumb.patch_1.txt | 5.76 KB | dww |
project_drupal_set_breadcrumb.patch.txt | 3.86 KB | dww |
Comments
Comment #1
dwwafter further digging into project's use of breadcrumbs, and reading the (rather ingenious, but somewhat depressing) http://www.angrydonuts.com/menu_set_location_can_eat_my_sho [rts!], i've improved upon my previous attempt.
this time, if the site has specifically hijacked /project into the menu tree and given it another name (like d.o does by making it a primary link called "Downloads") we actually honor that everywhere. ;) furthermore, it's silly to have
project_project_set_breadcrumb()
return a breadcrumb array, even though the name says "set". now, that function is responsible for callingdrupal_set_breadcrumb()
and it simplifies all the call sites. furthermore, there's no reason for that function to take a reference to $node (since it's not trying to change anything about $node), and in fact, $node should be an optional arg, anyway, so we can reuse all this code even when we're not looking specifically at a project node (e.g. in all the project browsing pages).Comment #2
dwwafter reviews eaton and others, committed to DRUPAL-4-7--2, installed on d.o, and backported to DRUPAL-4-7.
Comment #3
(not verified) CreditAttribution: commented