You are here

function custom_breadcrumbs_taxonomy_cb_node_form_table in Custom Breadcrumbs 6.2

Same name and namespace in other branches
  1. 7.2 custom_breadcrumbs_taxonomy/custom_breadcrumbs_taxonomy.module \custom_breadcrumbs_taxonomy_cb_node_form_table()

Implements hook_cb_node_form_table.

Parameters

$node : The node object being edited

Return value

$breadcrumbs an array of breadcrumb objects for taxonomy terms and vocabs matching the node to be used in the custom_breadcrumbs fieldset on the node edit page

File

custom_breadcrumbs_taxonomy/custom_breadcrumbs_taxonomy.module, line 511
This module implements taxonomy_based breadcrumbs using a hybrid of methods developed for the custom_breadcrumbs and taxonomy_breadcrumbs modules. Breadcrumbs are provided for node and taxonomy term pages. If 'Use taxonomy hierarchy' is…

Code

function custom_breadcrumbs_taxonomy_cb_node_form_table($node) {
  $breadcrumbs = array();
  if (_custom_breadcrumbs_taxonomy_allowed_node_type($node->type)) {
    if (!variable_get('custom_breadcrumbs_taxonomy_use_hierarchy', TRUE)) {

      // Check each term to see if it has a custom breadcrumb.
      $terms = taxonomy_node_get_terms($node);
      foreach ($terms as $term) {
        $more = custom_breadcrumbs_load_breadcrumbs('custom_breadcrumbs_taxonomy', 'custom_breadcrumbs_taxonomy_term', array(
          'tid' => $term->tid,
        ));
        if (!empty($more)) {
          $breadcrumbs = array_merge($breadcrumbs, $more);
        }
      }

      // Also look for a match on the taxonomy vocabulary.
      $vocabularies = taxonomy_get_vocabularies($node->type);
      foreach ($vocabularies as $vocabulary) {
        $more = custom_breadcrumbs_load_breadcrumbs('custom_breadcrumbs_taxonomy', 'custom_breadcrumbs_taxonomy_vocabulary', array(
          'vid' => $vocabulary->vid,
        ));
        if (!empty($more)) {
          $breadcrumbs = array_merge($breadcrumbs, $more);
        }
      }
    }
  }
  return $breadcrumbs;
}