You are here

public function EnvironmentIndicatorUISettingsForm::buildForm in Environment Indicator 8.3

Same name and namespace in other branches
  1. 4.x modules/environment_indicator_ui/src/Form/EnvironmentIndicatorUISettingsForm.php \Drupal\environment_indicator_ui\Form\EnvironmentIndicatorUISettingsForm::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

modules/environment_indicator_ui/src/Form/EnvironmentIndicatorUISettingsForm.php, line 24

Class

EnvironmentIndicatorUISettingsForm
Configuration form for Environment Indicator.

Namespace

Drupal\environment_indicator_ui\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('environment_indicator.indicator');
  $form = parent::buildForm($form, $form_state);
  $form['name'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Environment Name'),
    '#description' => $this
      ->t('Enter a name for this environment to be displayed in the admin toolbar.'),
    '#default_value' => $config
      ->get('name'),
  ];
  $form['fg_color'] = [
    '#type' => 'color',
    '#title' => $this
      ->t('Foreground Color'),
    '#description' => $this
      ->t('Foreground color for the admin toolbar. Ex: #0D0D0D.'),
    '#default_value' => $config
      ->get('fg_color'),
  ];
  $form['bg_color'] = [
    '#type' => 'color',
    '#title' => $this
      ->t('Background Color'),
    '#description' => $this
      ->t('Background color for the admin toolbar. Example: #4298f4.'),
    '#default_value' => $config
      ->get('bg_color'),
  ];
  return $form;
}