You are here

function faq_insert in Frequently Asked Questions 7

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

Implements hook_insert().

Inserts the faq node question text into the 'faq_questions' table.

Parameters

object $node: The node object.

1 call to faq_insert()
faq_update in ./faq.module
Implements hook_update().

File

./faq.module, line 240
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_insert($node) {
  $items = field_get_items('node', $node, 'field_detailed_question');
  $detailed_question = !empty($items) ? $items[0]['value'] : '';
  db_insert('faq_questions')
    ->fields(array(
    'nid' => $node->nid,
    'vid' => $node->vid,
    'question' => $node->title,
    'detailed_question' => $detailed_question,
  ))
    ->execute();
}