You are here

function faq_set_breadcrumb in Frequently Asked Questions 7

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

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

Parameters

object $term: The taxonomy term object.

Return value

array|NULL Breadcrumbs.

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 1627
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();
  $faq_path = _faq_path();
  if (variable_get('faq_custom_breadcrumbs', TRUE)) {
    if (module_exists("taxonomy") && $term) {
      $breadcrumb[] = l(faq_tt("taxonomy:term:{$term->tid}:name", $term->name), $faq_path . '/' . $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_path . '/' . $term->tid);
      }
    }
    $breadcrumb[] = l(t(variable_get('faq_title', 'Frequently Asked Questions')), $faq_path);
    $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();
}