Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
I've tried some trickery here, but I don't think it can necessarily be achieved at the theme level. I tried checking the breadcrumb[1] element for the home string, and unsetting it if it existed, but it didn't work for some reason.
Other trickery involved checking the length of the bcrumb array, but if you again pop bcrumb[1], you lose a part of the hierarchy, if the parent node is not in the hierarchy (ie you're outside of the node spectrum; admin > build > blocks would look like admin > blocks).
Getting this fixed so a root page could be set up with no worries would be cool!
Fixed. I'm removing the home node if it appears as the first item in the breadcrumb before adding it back again as 'Home'.
If your homepage is further down the hierarchy, I leave it alone, since if that's the case you obviously have some strange information architecture in mind and who am I to question your logic.
Weird. Suspect there is a small, easily fixed bug here. If I adapt the theme_breadcrumb function to add the current node's title, the removal of the home node fails, using the following line in template.php:
$breadcrumb[] = drupal_get_title();
I think this is due to there being some residuals in the breadcrumb; when I print the contents of the breadcrumb with the above line enabled in the function, the output is thus: Array ( [0] => [1] => Front ) - this causes the output to be "> Front" when on the home page (root node called "front" obviously)
Comments
Comment #1
niklp commentedI've tried some trickery here, but I don't think it can necessarily be achieved at the theme level. I tried checking the breadcrumb[1] element for the home string, and unsetting it if it existed, but it didn't work for some reason.
Other trickery involved checking the length of the bcrumb array, but if you again pop bcrumb[1], you lose a part of the hierarchy, if the parent node is not in the hierarchy (ie you're outside of the node spectrum; admin > build > blocks would look like admin > blocks).
Getting this fixed so a root page could be set up with no worries would be cool!
Comment #2
ronan commentedFixed. I'm removing the home node if it appears as the first item in the breadcrumb before adding it back again as 'Home'.
If your homepage is further down the hierarchy, I leave it alone, since if that's the case you obviously have some strange information architecture in mind and who am I to question your logic.
Comment #3
niklp commentedDoes this essentially have no effect on theming of breadcrumbs? So one can still address/change the breadcrumbs as per before with theme_breadcrumb()?
Thanks.
Comment #4
ronan commentedI'm using
drupal_set_breadcrumb()so there should be no change to how the breadcrumbs are themed.Also, I'm not adding a breadcumb if you're on the home page no matter where in the hierarchy the homepage lies. This seemed like expected behavior.
Comment #5
niklp commentedWeird. Suspect there is a small, easily fixed bug here. If I adapt the theme_breadcrumb function to add the current node's title, the removal of the home node fails, using the following line in template.php:
$breadcrumb[] = drupal_get_title();
I think this is due to there being some residuals in the breadcrumb; when I print the contents of the breadcrumb with the above line enabled in the function, the output is thus: Array ( [0] => [1] => Front ) - this causes the output to be "> Front" when on the home page (root node called "front" obviously)
Otherwise this now seems to work.
Comment #6
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #7
niklp commentedStill an issue here, should have changed the status previously.
Comment #8
niklp commentedThis has still not been fixed AFAIK. Just need to decipher where the empty array value is coming from and remove that element completely.
Comment #9
ronan commentedSorry for the log delay.
I've made a change to dev which I believe should remove the empty item in the breadcrumb array. Let me know if this fixes this issue for you.
Thanks
Ronan
Comment #10
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #11
niklp commentedNot yet verified, reopening.
Comment #12
ronan commentedI have posted some new code which may help fix your issue. Please check out the latest dev and see if it takes care of your issue.
Thanks
Ronan
Comment #13
niklp commentedThanks Ronan - I'll do another complete review of the module when I have some time.
Cheers,
Nik
Comment #14
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.