You are here

public function Maintenance200SettingsForm::buildForm in Maintenance 200 8

@inheritDoc

Overrides ConfigFormBase::buildForm

File

src/Form/Maintenance200SettingsForm.php, line 30

Class

Maintenance200SettingsForm

Namespace

Drupal\maintenance200\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('maintenance200.settings');
  $form['explanation'] = [
    '#type' => 'markup',
    '#markup' => 'Here, you can enable or disable the maintenance200 status code change functionality, and also set the status code that will be used if the functionality is enabled.',
  ];
  $form['maintenance200_enabled'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Change the status code during maintenance mode'),
    '#default_value' => $config
      ->get('maintenance200_enabled'),
  ];
  $form['maintenance200_status_code'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Status code to use'),
    '#maxlength' => '3',
    '#size' => '3',
    '#required' => TRUE,
    '#description' => $this
      ->t('A valid HTTP status code is required. See the Wikipedia <a href="http://en.wikipedia.org/wiki/List_of_HTTP_status_codes">HTTP status codes</a> page for a complete list.'),
    '#default_value' => $config
      ->get('maintenance200_status_code'),
  ];
  return parent::buildForm($form, $form_state);
}