function taxonomy_breadcrumb_nodeapi in Taxonomy Breadcrumb 5
Same name and namespace in other branches
- 6 taxonomy_breadcrumb.module \taxonomy_breadcrumb_nodeapi()
Implementation of hook_nodeapi().
File
- ./
taxonomy_breadcrumb.module, line 216 - The taxonomy_breadcrumb module generates taxonomy based breadcrumbs on node pages and taxonomy/term pages. The breadcrumb trail takes on the form: [HOME] >> [VOCABULARY] >> TERM >> [TERM] ...
Code
function taxonomy_breadcrumb_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
// If we are on a page view (not just a teaser), set the breadcrumb
// $a4 contains TRUE if we are on a page view
if ($op == 'view' && $a4 && !drupal_is_front_page() && arg(1) == $node->nid) {
// See if the node type of the current node is part of the node types listed on the advanced settings page.
$array_of_types = array_filter((array) variable_get('taxonomy_breadcrumb_node_types', TAXONOMY_BREADCRUMB_NODE_TYPES_DEFAULT));
$in_list = in_array($node->type, $array_of_types);
// if the node type IS IN the node types list and the list IS inclusive OR
// if the node type IS NOT IN the node types list and the list IS NOT inclusive (e.g. exclusive)
// THEN modify the breadcrumb trail.
if ($in_list == variable_get('taxonomy_breadcrumb_include_nodes', FALSE)) {
// Extract lightest term from lightest vocabulary associated with node.
$term = taxonomy_breadcrumb_node_get_lightest_term($node->nid);
$breadcrumb = taxonomy_breadcrumb_generate_breadcrumb($term->tid);
drupal_set_breadcrumb($breadcrumb);
}
}
}