Skip to content
Snippets Groups Projects
Commit 57d6dac0 authored by Angie Byron's avatar Angie Byron
Browse files

#867956 follow-up by sun: Clean-ups to previous patch

parent 6cacff4b
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -1110,11 +1110,18 @@ function comment_form_node_type_form_alter(&$form, $form_state) {
'js' => array(drupal_get_path('module', 'comment') . '/comment-node-form.js'),
),
);
// Unlike coment_form_node_form_alter(), all of these settings are applied
// as defaults to all new nodes. Therefore, it would be wrong to use #states
// to hide the other settings based on the primary comment setting.
$form['comment']['comment'] = array(
'#type' => 'select',
'#title' => t('Default comment setting for new content'),
'#default_value' => variable_get('comment_' . $form['#node_type']->type, COMMENT_NODE_OPEN),
'#options' => array(t('Hidden'), t('Closed'), t('Open')),
'#options' => array(
COMMENT_NODE_OPEN => t('Open'),
COMMENT_NODE_CLOSED => t('Closed'),
COMMENT_NODE_HIDDEN => t('Hidden'),
),
);
$form['comment']['comment_default_mode'] = array(
'#type' => 'checkbox',
......@@ -1135,13 +1142,10 @@ function comment_form_node_type_form_alter(&$form, $form_state) {
'#options' => array(
COMMENT_ANONYMOUS_MAYNOT_CONTACT => t('Anonymous posters may not enter their contact information'),
COMMENT_ANONYMOUS_MAY_CONTACT => t('Anonymous posters may leave their contact information'),
COMMENT_ANONYMOUS_MUST_CONTACT => t('Anonymous posters must leave their contact information'))
COMMENT_ANONYMOUS_MUST_CONTACT => t('Anonymous posters must leave their contact information'),
),
'#access' => user_access('post comments', drupal_anonymous_user()),
);
if (!user_access('post comments', drupal_anonymous_user())) {
$form['comment']['comment_anonymous']['#access'] = FALSE;
}
$form['comment']['comment_subject_field'] = array(
'#type' => 'checkbox',
'#title' => t('Allow comment title'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment