You are here

function faq_filter in Frequently Asked Questions 6

Implements hook_filter().

File

./faq.module, line 1417
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_filter($op, $delta = 0, $format = -1, $text = '', $cache_id = 0) {
  switch ($op) {
    case 'list':
      return array(
        0 => t('Embed FAQ page'),
      );
    case 'no cache':
      switch ($delta) {
        case 0:
          return TRUE;
      }
    case 'description':
      switch ($delta) {
        case 0:
          return t('Embed FAQ page using [faq] type tags.  Disables filter caching so not recommended for all input formats.');
      }
    case "process":
      switch ($delta) {
        case 0:
          $text = preg_replace_callback('/\\[faq:?([^\\]]*)\\]/', '_faq_faq_page_filter_replacer', $text);

          // Remove comments, as they're not supported by all input formats.
          $text = preg_replace('/<!--.*?-->/', '', $text);
          return $text;
      }
      return $text;
    default:
      return $text;
  }
}