You are here

function faq_set_breadcrumb in Frequently Asked Questions 6

Same name and namespace in other branches
  1. 7.2 faq.module \faq_set_breadcrumb()
  2. 7 faq.module \faq_set_breadcrumb()

Function to set up the FAQ breadcrumbs for a given taxonomy term.

Parameters

$term: The taxonomy term object.

2 calls to faq_set_breadcrumb()
faq_page in ./faq.module
Function to display the faq page.
faq_preprocess_page in ./faq.module
Implements template_preprocess_page().

File

./faq.module, line 1368
The FAQ module allows users to create a FAQ page, with questions and answers displayed in different styles, according to the settings.

Code

function faq_set_breadcrumb($term = NULL) {
  $breadcrumb = array();
  if (variable_get('faq_custom_breadcrumbs', TRUE)) {
    if (module_exists("taxonomy") && $term) {
      $breadcrumb[] = l(faq_tt("taxonomy:term:{$term->tid}:name", $term->name), 'faq/' . $term->tid);
      while ($parents = taxonomy_get_parents($term->tid)) {
        $term = array_shift($parents);
        $breadcrumb[] = l(faq_tt("taxonomy:term:{$term->tid}:name", $term->name), 'faq/' . $term->tid);
      }
    }
    $breadcrumb[] = l(variable_get('faq_title', 'Frequently Asked Questions'), 'faq');
    $breadcrumb[] = l(t('Home'), NULL, array(
      'attributes' => array(
        'title' => variable_get('site_name', ''),
      ),
    ));
    $breadcrumb = array_reverse($breadcrumb);
    return drupal_set_breadcrumb($breadcrumb);
  }

  // This is also used to set the breadcrumbs in the faq_preprocess_page()
  // so we need to return a valid trail.
  return drupal_get_breadcrumb();
}