hide Home on all pages

flutedrumr - March 21, 2008 - 15:29
Project:Menu Breadcrumb
Version:6.x-1.1
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:by design
Description

It would be great if there was an option to disable the root link on all pages, so only subnavigation showed in the breadcrumb.

I did this by adding

<?php
   
unset($breadcrumb[0]);
   
array_unshift($breadcrumb, array_shift($breadcrumb) );
?>

to menu_breadcrumb_init, but there may be a better way.

#1

gdevlugt - March 23, 2008 - 16:24

Hi,

I did some testing and it is possible to add this to menu breadcrumb, although it won't always work. The problem is that the breadcrumb is set in hook_init() and other (contributed) modules can override the breadcrumb in a later stage. One example is the FAQ module.

I was unable to find an appropiate hook to have the breadcrumb set. Two candidate hooks were hook_exit() and hook_footer(), but they are called when the breadcrumb is already rendered, thus too late.

I will add the functionality in the next few days, probably with a notice on the config page that it doesn't always work. Perhaps later on some workaround or overlooked solution will enable menu breadcrumb to have this functionality work consistently.

Thanks for the suggestion and I'll keep you updated when I add the 'hide home on all pages' option.

#2

xurizaemon - October 9, 2009 - 03:41
Status:active» by design

Suggest implementing this via theme_breadcrumb() instead of as the code above does.

Then you get to capture the breadcrumb once any other modules have messed around with it. Menu Breadcrumb's use of hook_init() appears to be less than ideal, and will probably be resolved with #599106: Reason for using hook_init?.

 
 

Drupal is a registered trademark of Dries Buytaert.