You are here

public function EnvironmentIndicatorSettingsForm::buildForm in Environment Indicator 4.x

Same name and namespace in other branches
  1. 8.3 src/Form/EnvironmentIndicatorSettingsForm.php \Drupal\environment_indicator\Form\EnvironmentIndicatorSettingsForm::buildForm()
  2. 8.2 lib/Drupal/environment_indicator/Form/EnvironmentIndicatorSettingsForm.php \Drupal\environment_indicator\Form\EnvironmentIndicatorSettingsForm::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/EnvironmentIndicatorSettingsForm.php, line 24

Class

EnvironmentIndicatorSettingsForm
Basic Environment Indicator controls form.

Namespace

Drupal\environment_indicator\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('environment_indicator.settings');
  $form = parent::buildForm($form, $form_state);
  $form['toolbar_integration'] = [
    '#type' => 'checkboxes',
    '#title' => $this
      ->t('Toolbar integration'),
    '#options' => [
      'toolbar' => $this
        ->t('Toolbar'),
    ],
    '#description' => $this
      ->t('Select the toolbars that you want to integrate with.'),
    '#default_value' => $config
      ->get('toolbar_integration') ?: [],
  ];
  $form['favicon'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Show favicon'),
    '#description' => $this
      ->t('If checked, a favicon will be added with the environment colors when the indicator is shown.'),
    '#default_value' => $config
      ->get('favicon') ?: FALSE,
  ];
  return $form;
}