You are here

function faq_load in Frequently Asked Questions 6

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

Implements hook_load().

Initialises $node->question using the value in the 'faq_questions' table.

Parameters

$node: The node object.

File

./faq.module, line 289
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_load($node) {
  $result = db_fetch_object(db_query('SELECT question, detailed_question FROM {faq_questions} WHERE nid = %d AND vid = %d', $node->nid, $node->vid));
  if ($result && !drupal_match_path($_GET['q'], 'node/' . $node->nid . '/edit')) {
    $question_length = variable_get('faq_question_length', 'short');
    if ($question_length == 'long' && !empty($result->detailed_question)) {
      $result->title = $result->detailed_question;
    }
    else {
      $result->title = $result->question;
    }
  }
  return $result;
}