function forum_form_alter
6.x forum.module | forum_form_alter(&$form, $form_state, $form_id) |
Implementation of hook_form_alter().
File
- drupal-6.x/
modules/ forum/ forum.module, line 360 - Enable threaded discussions about general topics.
Code
function forum_form_alter(&$form, $form_state, $form_id) {
$vid = variable_get('forum_nav_vocabulary', '');
if (isset($form['vid']) && $form['vid']['#value'] == $vid) {
// Hide critical options from forum vocabulary.
if ($form_id == 'taxonomy_form_vocabulary') {
$form['help_forum_vocab'] = array(
'#value' => t('This is the designated forum vocabulary. Some of the normal vocabulary options have been removed.'),
'#weight' => -1,
);
$form['content_types']['nodes']['#required'] = TRUE;
$form['hierarchy'] = array('#type' => 'value', '#value' => 1);
$form['settings']['required'] = array('#type' => 'value', '#value' => FALSE);
$form['settings']['relations'] = array('#type' => 'value', '#value' => FALSE);
$form['settings']['tags'] = array('#type' => 'value', '#value' => FALSE);
$form['settings']['multiple'] = array('#type' => 'value', '#value' => FALSE);
unset($form['delete']);
}
// Hide multiple parents select from forum terms.
elseif ($form_id == 'taxonomy_form_term') {
$form['advanced']['parent']['#access'] = FALSE;
}
}
if ($form_id == 'forum_node_form') {
// Make the vocabulary required for 'real' forum-nodes.
$vid = variable_get('forum_nav_vocabulary', '');
$form['taxonomy'][$vid]['#required'] = TRUE;
$form['taxonomy'][$vid]['#options'][''] = t('- Please choose -');
}
}