You are here

public function SettingsForm::buildForm in Sidr: Accessible Mobile Menus 8.2

Same name and namespace in other branches
  1. 8.3 src/Form/SettingsForm.php \Drupal\sidr\Form\SettingsForm::buildForm()
  2. 8 src/Form/SettingsForm.php \Drupal\sidr\Form\SettingsForm::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/SettingsForm.php, line 32

Class

SettingsForm
Global sidr settings form.

Namespace

Drupal\sidr\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('sidr.settings');
  $form['sidr_theme'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Sidr theme'),
    '#description' => $this
      ->t('If you want to style Sidr with your own CSS, choose %bare', [
      '%bare' => $this
        ->t('Bare'),
    ]),
    '#default_value' => $config
      ->get('sidr_theme') ?: 'bare',
    '#options' => [
      'bare' => $this
        ->t('Bare'),
      'light' => $this
        ->t('Light'),
      'dark' => $this
        ->t('Dark'),
    ],
  ];
  return parent::buildForm($form, $form_state);
}