You are here

function _custom_breadcrumbs_taxonomy_vocabulary_trail in Custom Breadcrumbs 6.2

Same name and namespace in other branches
  1. 7.2 custom_breadcrumbs_taxonomy/custom_breadcrumbs_taxonomy.inc \_custom_breadcrumbs_taxonomy_vocabulary_trail()

Generates the vocabulary trail.

Parameters

$vid: A taxonomy vocabulary id.

$is_term_page: TRUE if the breadcrumb is being prepared for the taxonomy term page, FALSE otherwise.

$objs: An optional array of objects to be used to determine breadcrumb visibility and for token replacement.

$types: An array of token types to be used in token replacement.

$part: A postive integer indicating the breadcrumb segment (home crumb = 0).

Return value

The breadcrumb trail.

1 call to _custom_breadcrumbs_taxonomy_vocabulary_trail()
custom_breadcrumbs_taxonomy_generate_breadcrumb in custom_breadcrumbs_taxonomy/custom_breadcrumbs_taxonomy.inc
Generates a breadcrumb from the taxonomy hierarchy of the term id or vocab id. This will only be called if custom_breadcrumbs_taxonomy_use_hierarchy has been enabled.

File

custom_breadcrumbs_taxonomy/custom_breadcrumbs_taxonomy.inc, line 320
Helper functions for custom_breadcrumbs_taxonomy.

Code

function _custom_breadcrumbs_taxonomy_vocabulary_trail($vid, $is_term_page = FALSE, $objs = array(), $types = array(
  'global' => NULL,
), $part = 1) {

  // Generate the VOCABULARY breadcrumb.
  $trail = array();

  // Check to see if a vocabulary breadcrumb exists.
  $breadcrumbs = custom_breadcrumbs_load_breadcrumbs('custom_breadcrumbs_taxonomy', 'custom_breadcrumbs_taxonomy_vocabulary', array(
    'vid' => $vid,
  ));
  $vocabulary_path = NULL;
  $title = NULL;
  $bid = NULL;
  if ($breadcrumb = custom_breadcrumbs_select_breadcrumb($breadcrumbs, $objs)) {
    $vocabulary_path = $breadcrumb->paths;
    $title = $breadcrumb->titles;
    $bid = $breadcrumb->bid;
    if (module_exists('token')) {
      $vocabulary_path = token_replace_multiple($vocabulary_path, $types);
      $title = token_replace_multiple($title, $types);
    }
  }
  if ($title == NULL) {
    $vocabulary = taxonomy_vocabulary_load($vid);
    $title = _custom_breadcrumbs_taxonomy_tt("taxonomy:vocabulary:{$vid}:name", $vocabulary->name);
  }
  if ($vocabulary_path != NULL) {
    $options = _custom_breadcrumbs_identifiers_option($part, $bid);
    $trail = array(
      l($title, $vocabulary_path, $options),
    );
  }
  elseif (variable_get('custom_breadcrumbs_taxonomy_show_vocabulary', FALSE)) {
    $trail = array(
      check_plain($title),
    );
  }
  return $trail;
}