You are here

public function StatusMessages::buildForm in Status Messages 8.3

Same name and namespace in other branches
  1. 8.4 src/Form/StatusMessages.php \Drupal\status_messages\Form\StatusMessages::buildForm()
  2. 8 src/Form/StatusMessages.php \Drupal\status_messages\Form\StatusMessages::buildForm()
  3. 8.2 src/Form/StatusMessages.php \Drupal\status_messages\Form\StatusMessages::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

src/Form/StatusMessages.php, line 32

Class

StatusMessages
Class StatusMessages.

Namespace

Drupal\status_messages\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('status_messages.status_messages');
  $form['configuration'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Configuration'),
  ];
  $options = [
    5000 => '5 Seconds',
    10000 => '10 Seconds',
    15000 => '15 Seconds',
    20000 => '20 Seconds',
    3600000 => 'Never',
  ];
  $form['configuration']['time'] = [
    '#type' => 'select',
    '#options' => $options,
    '#title' => $this
      ->t('Time'),
    '#default_value' => $config
      ->get('time'),
    '#description' => $this
      ->t('Close status message automatically after above seconds.'),
  ];
  return parent::buildForm($form, $form_state);
}