You are here

function demo_reset_form_demo_admin_settings_alter in Demonstration site (Sandbox / Snapshot) 7

Same name and namespace in other branches
  1. 6 demo_reset.module \demo_reset_form_demo_admin_settings_alter()

Implements hook_form_FORMID_alter().

File

demo_reset/demo_reset.module, line 14
Demonstration site reset module.

Code

function demo_reset_form_demo_admin_settings_alter(&$form, &$form_state) {
  $intervals = array(
    // 0, 5, 10, 15, 30 minutes.
    0,
    300,
    600,
    900,
    1800,
    // 1-6, 9, 12 hours.
    3600,
    3600 * 2,
    3600 * 3,
    3600 * 4,
    3600 * 5,
    3600 * 6,
    3600 * 9,
    3600 * 12,
    // 1-3 days.
    86400,
    86400 * 2,
    86400 * 3,
    // 1, 2, 3 weeks.
    604800,
    604800 * 2,
    604800 * 3,
    // 1, 3 months.
    86400 * 30,
    86400 * 90,
  );
  $intervals = drupal_map_assoc($intervals, 'format_interval');
  $form['demo_reset_interval'] = array(
    '#type' => 'select',
    '#title' => t('Automatic reset interval'),
    '#required' => FALSE,
    '#default_value' => variable_get('demo_reset_interval', 0),
    '#options' => $intervals,
    '#empty_value' => 0,
    '#description' => t('Requires a <a href="@snapshots-url">default snapshot</a> and <a href="@cron-url">cron</a> to run in the configured interval.', array(
      '@snapshots-url' => url('admin/structure/demo'),
      '@cron-url' => url('admin/config/system/cron'),
    )),
  );
}