You are here

function faq_init_back_to_top in Frequently Asked Questions 6

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

Helper function to setup the "back to top" link.

Parameters

$path: The path/url where the "back to top" link should bring the user too. This could be the 'faq' page or one of the categorized faq pages, e.g 'faq/123' where 123 is the tid.

Return value

An array containing the "back to top" link.

5 calls to faq_init_back_to_top()
template_preprocess_faq_category_questions_inline in includes/faq.questions_inline.inc
Create categorized FAQ page if set to show/hide the questions inline.
template_preprocess_faq_category_questions_top in includes/faq.questions_top.inc
Create categorized questions for FAQ page if set to show questions on top.
template_preprocess_faq_category_questions_top_answers in includes/faq.questions_top.inc
Create categorized answers for FAQ page if set to show the questions on top.
template_preprocess_faq_questions_inline in includes/faq.questions_inline.inc
Create the FAQ page if set to show the questions inline.
template_preprocess_faq_questions_top in includes/faq.questions_top.inc
Create the structure of the page, when the questions are to be shown on top.

File

./faq.module, line 1232
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_init_back_to_top($path) {
  $back_to_top = array();
  $back_to_top_text = trim(variable_get('faq_back_to_top', 'Back to Top'));
  if (!empty($back_to_top_text)) {
    $back_to_top = array(
      'title' => check_plain($back_to_top_text),
      'href' => $path,
      'attributes' => array(
        'title' => t('Go back to the top of the page.'),
      ),
      'fragment' => 'faq-top',
      'html' => TRUE,
    );
  }
  return $back_to_top;
}