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');
drupal_set_breadcrumb($breadcrumb);
}
If you are trying to change the breadcrumb for a specific content type nodes, try to use hook_node_view_alter()
Here's 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 this works... Muhammad