You are here

function faq_set_breadcrumb in Frequently Asked Questions 7.2

Same name and namespace in other branches
  1. 6 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 object: The taxonomy term object.

Return value

array|NULL

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

File

./faq.module, line 1448
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-page/' . $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-page/' . $term->tid);
      }
    }
    $breadcrumb[] = l(variable_get('faq_title', 'Frequently Asked Questions'), 'faq-page');
    $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();
}