You are here

function nodehierarchy_set_breadcrumbs in Node Hierarchy 6.2

Same name and namespace in other branches
  1. 5 nodehierarchy.module \nodehierarchy_set_breadcrumbs()
  2. 6.3 nodehierarchy.module \nodehierarchy_set_breadcrumbs()
  3. 6 nodehierarchy.module \nodehierarchy_set_breadcrumbs()
  4. 7.4 nodehierarchy.module \nodehierarchy_set_breadcrumbs()
  5. 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)

3 calls to nodehierarchy_set_breadcrumbs()
nodehierarchy_form_alter in ./nodehierarchy.module
Implementation of hooks_form_alter().
nodehierarchy_nodeapi in ./nodehierarchy.module
Implmentation of hook_nodeapi().
nodehierarchy_view_children in ./nodehierarchy.module
Display the children tab.

File

./nodehierarchy.module, line 1352
A module to make nodes hierarchical.

Code

function nodehierarchy_set_breadcrumbs($node, $add_node = FALSE) {

  // Place the given node.
  $breadcrumb = array();

  // Get all the possible breadcrumbs for the node.
  $breadcrumbs = nodehierarchy_get_breadcrumbs($node->nid);

  // There may be multiple breadcrumbs, but we only want one, so pick the first one.
  $breadcrumb = (array) @$breadcrumbs[0];

  // Remove the node itself if it's not needed (we would want it for the children tab for example).
  if (!$add_node) {
    array_pop($breadcrumb);
  }

  // Stick the home link on the top of the breadcrumb.
  array_unshift($breadcrumb, l(t('Home'), '<front>'));
  drupal_set_breadcrumb($breadcrumb);
}