You are here

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

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. 7.3 modules/content_lock_timeout/content_lock_timeout.module \content_lock_timeout_form_content_lock_admin_settings_alter()
  3. 7 modules/content_lock_timeout/content_lock_timeout.module \content_lock_timeout_form_content_lock_admin_settings_alter()
  4. 7.2 modules/content_lock_timeout/content_lock_timeout.module \content_lock_timeout_form_content_lock_admin_settings_alter()

Implement hook_form_FORM_ID_alter() to append settings to content_lock's settings page.

File

modules/content_lock_timeout/content_lock_timeout.module, line 12
Allowed time-based automatic unlocking of nodes locked for editing with content_lock.

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 number of minutes that each lock may be kept. Set to zero to not break locks based on time.'),
    '#default_value' => variable_get('content_lock_timeout_minutes', 120),
  );
  $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', FALSE),
  );

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