You are here

function _custom_breadcrumbs_taxonomy_vocabulary_trail in Custom Breadcrumbs 7.2

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

Generates the vocabulary trail.

@codingStandardsIgnoreStart

Parameters

string $vid: A taxonomy vocabulary id.

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

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

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

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

Return value

array The breadcrumb trail.

1 call to _custom_breadcrumbs_taxonomy_vocabulary_trail()
custom_breadcrumbs_taxonomy_generate_breadcrumb in custom_breadcrumbs_taxonomy/custom_breadcrumbs_taxonomy.inc
Generate Breadcrumb.

File

custom_breadcrumbs_taxonomy/custom_breadcrumbs_taxonomy.inc, line 356
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) {

  // @codingStandardsIgnoreEnd
  // 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;
    $vocabulary_path = token_replace($vocabulary_path, $types, array(
      'clear' => TRUE,
    ));
    $title = token_replace($title, $types, array(
      'clear' => TRUE,
    ));
  }
  if ($title == NULL) {
    $vocabulary = taxonomy_vocabulary_load($vid);
    $title = _custom_breadcrumbs_taxonomy_tt(array(
      '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;
}