function comment_form_alter in Drupal 5
Same name and namespace in other branches
- 4 modules/comment.module \comment_form_alter()
- 6 modules/comment/comment.module \comment_form_alter()
File
- modules/
comment/ comment.module, line 369 - Enables users to comment on published content.
Code
function comment_form_alter($form_id, &$form) {
if ($form_id == 'node_type_form' && isset($form['identity']['type'])) {
$form['workflow']['comment'] = array(
'#type' => 'radios',
'#title' => t('Default comment setting'),
'#default_value' => variable_get('comment_' . $form['#node_type']->type, COMMENT_NODE_READ_WRITE),
'#options' => array(
t('Disabled'),
t('Read only'),
t('Read/Write'),
),
'#description' => t('Users with the <em>administer comments</em> permission will be able to override this setting.'),
);
}
elseif (isset($form['type'])) {
if ($form['type']['#value'] . '_node_form' == $form_id) {
$node = $form['#node'];
$form['comment_settings'] = array(
'#type' => 'fieldset',
'#access' => user_access('administer comments'),
'#title' => t('Comment settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => 30,
);
$form['comment_settings']['comment'] = array(
'#type' => 'radios',
'#parents' => array(
'comment',
),
'#default_value' => $node->comment,
'#options' => array(
t('Disabled'),
t('Read only'),
t('Read/Write'),
),
);
}
}
}