1 system.admin.inc system_site_maintenance_mode($form, &$form_state)

Form builder; Configure the site's maintenance status.

See also

system_site_maintenance_mode_submit()

Related topics

File

core/modules/system/system.admin.inc, line 2008
Admin page callbacks for the system module.

Code

function system_site_maintenance_mode($form, &$form_state) {
  $config = config('system.core');
  $form['maintenance_mode'] = array(
    '#type' => 'checkbox',
    '#title' => t('Put site into maintenance mode'),
    '#default_value' => state_get('maintenance_mode', FALSE),
    '#description' => t('Visitors will only see the maintenance mode message. Only users with the "Access site in maintenance mode" <a href="@permissions-url">permission</a> will be able to access the site. Authorized users can log in directly via the <a href="@user-login">user login</a> page.', array('@permissions-url' => url('admin/config/people/permissions'), '@user-login' => url('user'))),
  );
  $form['maintenance_mode_message'] = array(
    '#type' => 'textarea',
    '#title' => t('Message to display when in maintenance mode'),
    '#default_value' => $config->get('maintenance_mode_message'),
    '#description' => theme('token_tree_link'),
    '#element_validate' => array('token_element_validate'),
  );

  $form['actions']['#type'] = 'actions';
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  return $form;
}