You are here

function revision_all_form_alter in Revision All 7

Same name and namespace in other branches
  1. 8 revision_all.module \revision_all_form_alter()
  2. 6 revision_all.module \revision_all_form_alter()
  3. 7.2 revision_all.module \revision_all_form_alter()

Implements hook_form_alter().

If the "Revision All" setting is checked, check the "Create new revision" checkbox.

If the "Prevent Revisioning Overrides" setting is checked, node forms are altered to disable access to the "Create new revision" checkbox.

File

./revision_all.module, line 158
Permits configuring content revision settings from a central location. Also makes alterations to existing forms based on user specified settings.

Code

function revision_all_form_alter(&$form, &$form_state, $form_id) {
  $settings = variable_get('revision_all', array());
  if (!empty($form['#node_edit_form'])) {
    if ($settings['revision-all']) {
      $form['revision_information']['revision']['#default_value'] = TRUE;
    }
    if ($settings['prevent-override']) {
      $form['revision_information']['revision']['#disabled'] = TRUE;
    }
  }
}