You are here

function mcd_form_system_site_maintenance_settings_alter in Maintenance Countdown 6

Implements hook_form_FORM_ID_alter().

File

./mcd.module, line 23
This module provides the maintenance page with nice countdown timer. So now you may set time for your maintenance work and your visitors will see when time is up.

Code

function mcd_form_system_site_maintenance_settings_alter(&$form, $form_state) {
  $form['mcd'] = array(
    '#type' => 'fieldset',
    '#title' => t('Maintenance Countdown settings'),
    '#collapsible' => TRUE,
    '#element_validate' => array(
      'mcd_form_validate',
    ),
    '#weight' => 0.001,
  );
  $form['mcd']['help_info'] = array(
    '#type' => 'markup',
    '#value' => '<p>' . t("Here you may set maintenance time. i.e. how long site will be offline. For example, if you plan switch site offline for 5 minutes, enter '5' (without apostrophes) in 'Minutes' field. If you need 100 hours, just do it — feel free to enter '100' (without apostrophes) in 'Hours' field.") . '</p>',
  );
  $form['mcd']['mcd_months'] = array(
    '#title' => t('Month(s)'),
    '#type' => 'textfield',
    '#size' => 3,
    '#maxlength' => 3,
    '#default_value' => variable_get('mcd_months', 0),
    '#prefix' => '<div class="mcd">',
  );
  $form['mcd']['mcd_days'] = array(
    '#title' => t('Day(s)'),
    '#type' => 'textfield',
    '#size' => 3,
    '#maxlength' => 3,
    '#default_value' => variable_get('mcd_days', 0),
  );
  $form['mcd']['mcd_hours'] = array(
    '#title' => t('Hours(s)'),
    '#type' => 'textfield',
    '#size' => 3,
    '#maxlength' => 3,
    '#default_value' => variable_get('mcd_hours', 0),
  );
  $form['mcd']['mcd_minutes'] = array(
    '#title' => t('Minute(s)'),
    '#type' => 'textfield',
    '#size' => 3,
    '#maxlength' => 3,
    '#default_value' => variable_get('mcd_minutes', 0),
  );
  $form['mcd']['mcd_seconds'] = array(
    '#title' => t('Seconds'),
    '#type' => 'textfield',
    '#size' => 3,
    '#maxlength' => 3,
    '#default_value' => variable_get('mcd_seconds', 0),
    '#suffix' => '</div>',
  );
  $form['mcd']['mcd_time_up_message'] = array(
    '#title' => t('Message after time is up'),
    '#type' => 'textarea',
    '#default_value' => variable_get('mcd_time_up_message', t('Time is up. Please reload this page by hitting <kbd>F5</kbd> on your keyboard or click on "Reload" button below.')),
    '#description' => t('Write some message that will be shown after time is up. HTML allowed.'),
  );

  //  Reload settings
  $form['mcd']['reload_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Maintenance page reload settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['mcd']['reload_settings']['mcd_reload_button'] = array(
    '#type' => 'radios',
    '#default_value' => variable_get('mcd_reload_button', 0),
    '#options' => array(
      t('Show reload button'),
      t("Don't show reload button"),
      t("Don't show reload button, but add auto-reloading maintenance page every 15 seconds after time is up"),
    ),
  );

  //  Page theme setings
  $form['mcd']['theme_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Maintenance page theme settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['mcd']['theme_settings']['mcd_page_themes'] = array(
    '#type' => 'select',
    '#title' => t('Select page theme'),
    '#default_value' => variable_get('mcd_page_themes', 'light'),
    '#options' => array(
      'light' => t('Light'),
      'dark' => t('Dark'),
    ),
  );
  $form['#submit'][] = 'mcd_submit';
}