| Versions | |
|---|---|
| 4.7 – 5 | forum_form(&$node) |
| 6 | forum_form(&$node, $form_state) |
| 7 | forum_form($node, $form_state) |
Implementation of hook_form().
modules/
<?php
function forum_form(&$node) {
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Subject'),
'#default_value' => $node->title,
'#required' => TRUE,
'#weight' => -5,
);
if ($node->nid) {
$forum_terms = taxonomy_node_get_terms_by_vocabulary(_forum_get_vid(), $node->nid);
// if editing, give option to leave shadows
$shadow = (count($forum_terms) > 1);
$form['shadow'] = array(
'#type' => 'checkbox',
'#title' => t('Leave shadow copy'),
'#default_value' => $shadow,
'#description' => t('If you move this topic, you can leave a link in the old forum to the new forum.'),
);
}
$form['body_filter']['body'] = array(
'#type' => 'textarea',
'#title' => t('Body'),
'#default_value' => $node->body,
'#rows' => 20,
'#required' => TRUE,
);
$form['body_filter']['format'] = filter_form($node->format);
return $form;
}
?>