You are here

function _faq_faq_page_filter_replacer in Frequently Asked Questions 7

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

Helper function for faq input filter.

1 string reference to '_faq_faq_page_filter_replacer'
_faq_filter_process in ./faq.module
Filter string.

File

./faq.module, line 1716
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_faq_page_filter_replacer($matches) {
  $tid = 0;
  $faq_display = '';
  $category_display = '';
  $default_display = array(
    'questions_top',
    'hide_answer',
    'questions_inline',
    'new_page',
  );
  $default_category_display = array(
    'hide_qa',
    'new_page',
    'categories_inline',
  );
  if (drupal_strlen($matches[1])) {
    list($tid, $faq_display, $category_display) = explode(',', $matches[1] . ',,');
    $tid = (int) trim($tid);
    $faq_display = trim($faq_display);
    $category_display = trim($category_display);

    // These two checks ensure that a typo in the faq_display or
    // category_display string still results in the FAQ showing.
    if ($faq_display && !in_array($faq_display, $default_display)) {
      $faq_display = '';
    }
    if ($category_display && !in_array($category_display, $default_category_display)) {
      $category_display = '';
    }
  }
  return faq_page($tid, $faq_display, $category_display);
}