function better_revisions_form_alter in Better Revisions 7
Same name and namespace in other branches
- 8 better_revisions.module \better_revisions_form_alter()
File
- ./
better_revisions.module, line 45 - Main enhanced revisions module file.
Code
function better_revisions_form_alter(&$form, &$form_state, $form_id) {
if (isset($form['revision_information']['log'])) {
$form['revision_information']['#attached']['js'][] = drupal_get_path('module', 'better_revisions') . '/better_revisions.js';
$req = variable_get('br_require', FALSE);
$condition = array(
':input[name="revision"]' => array(
'checked' => TRUE,
),
);
$form['revision_information']['log']['#title'] = variable_get('br_list_title', BF_DEFAULT_TITLE);
if ($desc = variable_get('br_list_help', NULL)) {
$form['revision_information']['log']['#description'] = filter_xss_admin($desc);
}
$form['revision_information']['log']['#type'] = 'select';
$form['revision_information']['log']['#options'] = _better_revisions_options();
$form['revision_information']['log']['#states'] = array(
'visible' => $condition,
);
$area = variable_get('br_add_txt', 0);
if ($area != 0) {
$fset = 'revision_information';
if (module_exists('workbench_moderation')) {
if (workbench_moderation_node_type_moderated($form['#node']->type) && $form['options']['#access']) {
$fset = 'options';
}
}
$form[$fset]['log_extra'] = array(
'#type' => 'textarea',
'#default_value' => '',
'#title' => variable_get('br_area_title', BF_DEFAULT_AREA_TITLE),
'#states' => array(
'visible' => $condition,
),
'#weight' => 1,
);
$form['#submit'][] = 'better_revisions_log_combine';
}
if ($req || $area == 2) {
$form['#validate'][] = '_better_revisions_validate';
}
}
}