Contributions API

Calling all Drupal developers!

Help us get this on the first page of Digg. DIGG NOW!

Modules in 6

faq_form

Definition

faq_form(&$node, &$param)
contributions/faq/faq.module, line 172

Description

Defines the form where new questions and answers are written.

Parameters

&$node The node being added or edited.

&$param The hook can set this variable to an associative array of attributes to add to the enclosing <form> tag.

Return value

The form elements in the $form array.

Code

<?php
function faq_form(&$node, &$param) {
  $type = node_get_types('type', $node);

  // Question.
  $form['title'] = array(
    '#type' => 'textarea',
    '#title' => check_plain($type->title_label),
    '#default_value' => $node->title,
    '#required' => TRUE,
    '#weight' => 0,
    '#rows' => 3,
    '#description' => t('Question to be answered'),
  );

  // Answer.
  $form['body_field'] = node_body_field($node, $type->body_label, $type->min_word_count);
  $form['body_field']['body']['#description'] = t('This is that answer to the question.  It will be filtered according to the input format.');

  return $form;
}
?>