You are here

function content_lock_timeout_form_content_lock_admin_settings_alter in Content locking (anti-concurrent editing) 7.2

Same name and namespace in other branches
  1. 6.2 modules/content_lock_timeout/content_lock_timeout.module \content_lock_timeout_form_content_lock_admin_settings_alter()
  2. 6 modules/content_lock_timeout/content_lock_timeout.module \content_lock_timeout_form_content_lock_admin_settings_alter()
  3. 7.3 modules/content_lock_timeout/content_lock_timeout.module \content_lock_timeout_form_content_lock_admin_settings_alter()
  4. 7 modules/content_lock_timeout/content_lock_timeout.module \content_lock_timeout_form_content_lock_admin_settings_alter()

Implements hook_form_FORM_ID_alter().

File

modules/content_lock_timeout/content_lock_timeout.module, line 11
Allowed time-based automatic unlocking of nodes.

Code

function content_lock_timeout_form_content_lock_admin_settings_alter(&$form, &$form_state) {
  $form['content_lock_timeout'] = array(
    '#type' => 'fieldset',
    '#title' => t('Lock Timeouts'),
    '#description' => t('Configure automatic stale lock breaking.'),
    '#collapsible' => TRUE,
  );
  $form['content_lock_timeout']['content_lock_timeout_minutes'] = array(
    '#type' => 'textfield',
    '#title' => t('Lock timeout'),
    '#description' => t('The maximum time in minutes that each lock may be kept. To disable breaking locks after a timeout, please !disable the Content Lock Timeout module.', array(
      '!disable' => l(t('disable'), 'admin/build/modules', array(
        'fragment' => 'edit-status-content-lock-timeout-wrapper',
      )),
    )),
    '#default_value' => variable_get('content_lock_timeout_minutes', 30),
  );
  $form['content_lock_timeout']['content_lock_timeout_on_edit'] = array(
    '#type' => 'checkbox',
    '#title' => t('Break stale locks on edit'),
    '#description' => t("By default, stale locks will be broken when cron is run. This option enables checking for stale locks when a user clicks a node's Edit link, enabling lower lock timeout values without having to run cron every few minutes."),
    '#default_value' => variable_get('content_lock_timeout_on_edit', TRUE),
  );

  // Apply some form beautification.
  $form['buttons']['#weight'] = 2;
  $form['#validate'][] = 'content_lock_timeout_admin_settings_validate';
}