You are here

public function SiteMaintenanceModeForm::buildForm in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/system/src/Form/SiteMaintenanceModeForm.php \Drupal\system\Form\SiteMaintenanceModeForm::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides ConfigFormBase::buildForm

File

core/modules/system/src/Form/SiteMaintenanceModeForm.php, line 67
Contains \Drupal\system\Form\SiteMaintenanceModeForm.

Class

SiteMaintenanceModeForm
Configure maintenance settings for this site.

Namespace

Drupal\system\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('system.maintenance');
  $form['maintenance_mode'] = array(
    '#type' => 'checkbox',
    '#title' => t('Put site into maintenance mode'),
    '#default_value' => $this->state
      ->get('system.maintenance_mode'),
    '#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' => $this
        ->url('user.admin_permissions'),
      ':user-login' => $this
        ->url('user.login'),
    )),
  );
  $form['maintenance_mode_message'] = array(
    '#type' => 'textarea',
    '#title' => t('Message to display when in maintenance mode'),
    '#default_value' => $config
      ->get('message'),
  );
  return parent::buildForm($form, $form_state);
}