You are here

public function DropdownLanguageSettings::buildForm in Dropdown Language 8

Same name and namespace in other branches
  1. 8.3 src/Form/DropdownLanguageSettings.php \Drupal\dropdown_language\Form\DropdownLanguageSettings::buildForm()
  2. 8.2 src/Form/DropdownLanguageSettings.php \Drupal\dropdown_language\Form\DropdownLanguageSettings::buildForm()
  3. 3.0.x src/Form/DropdownLanguageSettings.php \Drupal\dropdown_language\Form\DropdownLanguageSettings::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/DropdownLanguageSettings.php, line 32

Class

DropdownLanguageSettings
Provides a configuration form for global settings.

Namespace

Drupal\dropdown_language\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('dropdown_language.setting');
  $form['display_language_id'] = [
    '#type' => 'radios',
    '#options' => [
      '1' => $this
        ->t('Show Language Name'),
      '0' => $this
        ->t('Show Language ID'),
      '2' => $this
        ->t('Use Custom Labels for Language Names (per block instance)'),
    ],
    '#title' => $this
      ->t('Display Language Labelling'),
    '#default_value' => $config
      ->get('display_language_id'),
  ];
  $form['decor'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('<q>Switch Language</q> Decor'),
    '#open' => TRUE,
  ];
  $form['decor']['wrapper'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Show block with fieldset wrapping'),
    '#default_value' => $config
      ->get('wrapper'),
  ];
  return parent::buildForm($form, $form_state);
}