From 9f3d9f11158aec709dac7d67b99ff6fd8c2c634d Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 27 Sep 2008 20:37:01 +0000 Subject: - Patch #161301 by Eaton, Sun, moshe and webchick: make checking for node edit forms easier. DX improvement. --- modules/comment/comment.module | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'modules/comment/comment.module') diff --git a/modules/comment/comment.module b/modules/comment/comment.module index f1af2b608..80e9aad2f 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -532,24 +532,22 @@ function comment_form_alter(&$form, $form_state, $form_id) { '#options' => array(t('Display on separate page'), t('Display below post or comments')), ); } - elseif (isset($form['type']) && isset($form['#node'])) { - 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')), - ); - } + elseif (!empty($form['#node_edit_form'])) { + $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')), + ); } } -- cgit v1.2.3