function better_formats_set_comment_format in Better Formats 6
Same name and namespace in other branches
- 6.2 better_formats.module \better_formats_set_comment_format()
Processes formats for core node comment form.
See also
1 call to better_formats_set_comment_format()
- better_formats_form_alter in ./
better_formats.module - Implementation of hook_form_alter().
File
- ./
better_formats.module, line 380 - Enhances Drupal's core input format settings.
Code
function better_formats_set_comment_format(&$form) {
if (isset($form['comment_filter']['format'])) {
$node = node_load($form['nid']['#value']);
// Get BF default format.
$default = better_formats_get_default_format('comment', $node->type);
if (empty($form['cid']['#value'])) {
// Set format to default for new entries.
$format = $default;
}
else {
// Get existing format for comment.
$format = better_formats_get_current_format($form['comment_filter']['format']);
}
// Overwrite the filter form with our own.
$form['comment_filter']['format'] = better_formats_filter_form($format, $default, 'comment', $node->type);
}
}