function nodehierarchy_set_breadcrumbs in Node Hierarchy 6
Same name and namespace in other branches
- 5 nodehierarchy.module \nodehierarchy_set_breadcrumbs()
- 6.3 nodehierarchy.module \nodehierarchy_set_breadcrumbs()
- 6.2 nodehierarchy.module \nodehierarchy_set_breadcrumbs()
- 7.4 nodehierarchy.module \nodehierarchy_set_breadcrumbs()
- 7.2 nodehierarchy.module \nodehierarchy_set_breadcrumbs()
Set the breadcrumbs and active menu to reflect the position of the given node in the site hierarchy.
Parameters
$node: The current node
$add_node: Whether we want the current node in the breadcrumb (eg: for the children tab)
2 calls to nodehierarchy_set_breadcrumbs()
- nodehierarchy_nodeapi in ./
nodehierarchy.module - Implmentation of hook_nodeapi().
- nodehierarchy_view_children in ./
nodehierarchy.module - Display the children tab.
File
- ./
nodehierarchy.module, line 783
Code
function nodehierarchy_set_breadcrumbs($node, $add_node = FALSE) {
// Place the given node.
$breadcrumb = array();
$parent = $node;
$homepage = drupal_get_normal_path(variable_get('site_frontpage', 'node'));
while (@$parent->nid) {
$item = menu_get_item("node/" . $parent->nid);
if (($add_node || $parent->nid != $node->nid) && $item['href'] != '<front>' && $item['href'] != $homepage) {
$breadcrumb[] = l($parent->title, "node/" . $parent->nid);
}
$parent = node_load($parent->parent);
}
$breadcrumb[] = l(t('Home'), '<front>');
drupal_set_breadcrumb(array_reverse($breadcrumb));
}