flatcomments.module in Flatcomments 5
Same filename and directory in other branches
Make comments replies to the node, regardless of the reply link used.
File
flatcomments.moduleView source
<?php
/**
* @file
* Make comments replies to the node, regardless of the reply link used.
*/
/**
* Implementation of hook_form_alter().
*/
function flatcomments_form_alter($form_id, &$form) {
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']);
$display_mode = (int) variable_get('comment_default_mode', 0);
if (($display_mode === 1 || $display_mode === 2) && !$form['cid']['#value']) {
$form['pid']['#value'] = NULL;
}
break;
case 'comment_admin_settings':
$form['viewing_options']['comment_default_mode']['#description'] .= t(' <strong>Flatcomments enabled:</strong> Flat list options will force replies to be to the main post.');
break;
}
}
Functions
Name | Description |
---|---|
flatcomments_form_alter | Implementation of hook_form_alter(). |