You are here

public function VISettingsForm::buildForm in Visually Impaired Support (module) 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/VISettingsForm.php, line 60

Class

VISettingsForm
Defines a form that configures forms module settings.

Namespace

Drupal\visually_impaired_module\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('visually_impaired_module.visually_impaired_module.settings');
  $themes = [];
  $options = $this->themeHandler
    ->listInfo();
  foreach ($options as $name => $attr) {
    if ($attr->status) {
      $themes[$name] = $attr->info['name'];
    }
  }
  $form['default_visually_impaired_theme'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Select Visually Impaired Theme'),
    '#options' => $themes,
    '#default_value' => $config
      ->get('visually_impaired_theme'),
  ];
  return parent::buildForm($form, $form_state);
}