How can I add breadcrumb to a page in my attendance module.

I have used the following hook, but it changed the breadcrumb for all pages in other modules also.

function attendance_init() {
// set the breadcrumb
$breadcrumb = array();
$breadcrumb[] = l('Home', '<front>');
$breadcrumb[] = l('People', 'group/node/'. arg(2) .'/people');
$breadcrumb[] = l('Attendance', 'group/node/'. arg(2) .'/people/attendance');

  • 1
    "to a page" - but to which page? Is it a specific node with a given node id or something else?
    – Sk8erPeter
    Apr 10, 2012 at 12:37
  • this is bound to happen with hook_init, like the posts below choosing the appropriate condition for page helps decide the hook better.. perhaps if you could edit your query to describe the specific case we could suggest you the hook Apr 10, 2012 at 12:50
  • yep, please describe the use case better!
    – donquixote
    Jun 25, 2013 at 15:24

2 Answers 2


Could you get what you want from the Custom Breadcrumbs module?

Allows administrators to set up parametrized breadcrumb trails for any node type. This allows CCK-style node types to have "Home > User Blog >2005 > January" style breadcrumbs on the node view page itself, synchronizing cleanly with custom views or pathauto aliases. Breadcrumb visibility can be customized via a php snippet.


About breadcrumb If you want to change in a node you can use hook_node_view to change breadcrumb an you can check $node->tyoe

function hook_node_view($node)

if you want to use it in a page you can check arg or $_GET['q'] in any of hook_page Hope it can help you

  • You forgot to define the $breadcrumb array mentioned in the question, and passing it to drupal_set_breadcrumb. So at the end, it should look like this: drupal_set_breadcrumb($breadcrumb);.
    – Sk8erPeter
    Sep 2, 2013 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.