You are here

function new_faq_view in Frequently Asked Questions 7.2

Implements hook_view().

File

./faq.module, line 379
The FAQ module allows users to create a FAQ page, with questions and answers displayed in different styles, according to the settings.

Code

function new_faq_view($node, $view_mode) {
  drupal_add_css(drupal_get_path('module', 'faq') . '/faq.css');
  $language = $node->language;
  if (isset($node->body[$language]) && $node->body[$language]) {
    $node->detailed_question = check_markup($node->detailed_question, $node->body[$language][0]['format'], $language);
    if (!isset($node->body[$language][0])) {
      drupal_set_message('<pre>' . print_r($node->body, TRUE) . '</pre>');
    }
  }
  else {
    $node->detailed_question = check_markup($node->detailed_question, NULL, $language);
  }
  if (!empty($node->detailed_question) && variable_get('faq_question_length', 'short') == 'both' && (variable_get('faq_display', 'questions_top') == 'hide_answer' || drupal_match_path($_GET['q'], 'node/' . $node->nid))) {
    $node->content['detailed_question'] = array(
      '#markup' => '<div class="faq-detailed-question">' . $node->detailed_question . '</div>',
      '#weight' => '-1',
    );
  }
  return $node;
}