? .flatcomments.module.swp ? flatcomments_splitup_form_alter_6.patch Index: flatcomments.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/flatcomments/flatcomments.module,v retrieving revision 1.5.4.1.2.3 diff -u -p -r1.5.4.1.2.3 flatcomments.module --- flatcomments.module 4 May 2008 13:32:26 -0000 1.5.4.1.2.3 +++ flatcomments.module 16 Nov 2008 19:25:47 -0000 @@ -8,32 +8,31 @@ */ /** - * Modify the parent ID in comment_form and provide settings on node type configuration pages. + * Modify the parent ID in comment_form. * - * Implementation of hook_form_alter(). + * Implementation of hook_form_[comment_form]_alter(). */ -function flatcomments_form_alter(&$form, &$form_state, $form_id) { - switch ($form_id) { - - case 'comment_form': - // Check whether flatcomments are enabled for this node type and it's not an existing comment. - // If so, make the node the parent by setting pid to NULL. - $node = node_load($form['nid']['#value']); - if (variable_get("flatcomments_{$node->type}", FALSE) && !$form['cid']['#value']) { - $form['pid']['#value'] = NULL; - } - break; - - case 'node_type_form': +function flatcomments_form_comment_form_alter(&$form, &$form_state) { + // Check whether flatcomments are enabled for this node type and it's not an existing comment. + // If so, make the node the parent by setting pid to NULL. + $node = node_load($form['nid']['#value']); + if (variable_get("flatcomments_{$node->type}", FALSE) && !$form['cid']['#value']) { + $form['pid']['#value'] = NULL; + } +} - if (isset($form['identity']['type']) && isset($form['comment'])) { - $form['comment']["flatcomments"] = array( - '#type' => 'checkbox', - '#title' => t('Make all comments replies to the main post, regardless of the reply link used.'), - '#default_value' => variable_get("flatcomments_{$form['#node_type']->type}", FALSE), - ); - } - break; +/** + * Provide settings on node type configuration pages. + * + * Implementation of hook_form_[node_type_form]_alter(). + */ +function flatcomments_form_node_type_form_alter(&$form, &$form_state) { + if (isset($form['identity']['type']) && isset($form['comment'])) { + $form['comment']["flatcomments"] = array( + '#type' => 'checkbox', + '#title' => t('Make all comments replies to the main post, regardless of the reply link used.'), + '#default_value' => variable_get("flatcomments_{$form['#node_type']->type}", FALSE), + ); } } @@ -50,4 +49,4 @@ function flatcomments_node_type($op, $in variable_del("flatcomments_{$info->type}"); break; } -} \ No newline at end of file +}