You are here

public function SettingsForm::buildForm in Lightning Scheduler 8

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/SettingsForm.php, line 35

Class

SettingsForm
The settings form for controlling Lightning Scheduler's behavior.

Namespace

Drupal\lightning_scheduler\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['time_step'] = [
    '#type' => 'select',
    '#title' => $this
      ->t("The time input's step attribute"),
    '#options' => [
      1 => $this
        ->formatPlural(1, '1 second', '@count seconds'),
      60 => $this
        ->formatPlural(1, '1 minute', '@count minutes'),
      300 => $this
        ->formatPlural(5, '1 minute', '@count minutes'),
      600 => $this
        ->formatPlural(10, '1 minute', '@count minutes'),
      900 => $this
        ->formatPlural(15, '1 minute', '@count minutes'),
      1800 => $this
        ->formatPlural(30, '1 minute', '@count minutes'),
      3600 => $this
        ->formatPlural(1, '1 hour', '@count hours'),
    ],
    '#required' => TRUE,
    '#default_value' => $this
      ->config('lightning_scheduler.settings')
      ->get('time_step'),
  ];
  return parent::buildForm($form, $form_state);
}