How to add breadcrumbs?

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

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

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');
drupal_set_breadcrumb($breadcrumb);         
}
+5
source share
1 answer

If you are trying to change the palette for specific content type nodes, try using hook_node_view_alter ()

Here is an example:

function attendance_node_view_alter(&$build)
{
    $node = $build['#node'];
    if($build['#view_mode'] == "full" && $node->type == "attendance")
    {
        $breadcrumb = array();
        $breadcrumb[] = l('Home', '<front>');
        $breadcrumb[] = l('People', 'group/node/'. arg(2) .'/people');
        $breadcrumb[] = l('Attendance', 'group/node/'. arg(2) .'/people/attendance');
        drupal_set_breadcrumb($breadcrumb);
    }
}

Hope it works ... Muhammad

+5
source

All Articles