You are here

public function NegotiationSelectedForm::buildForm in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/language/src/Form/NegotiationSelectedForm.php \Drupal\language\Form\NegotiationSelectedForm::buildForm()
  2. 10 core/modules/language/src/Form/NegotiationSelectedForm.php \Drupal\language\Form\NegotiationSelectedForm::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

core/modules/language/src/Form/NegotiationSelectedForm.php, line 33

Class

NegotiationSelectedForm
Configure the selected language negotiation method for this site.

Namespace

Drupal\language\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('language.negotiation');
  $form['selected_langcode'] = [
    '#type' => 'language_select',
    '#title' => $this
      ->t('Language'),
    '#languages' => LanguageInterface::STATE_CONFIGURABLE | LanguageInterface::STATE_SITE_DEFAULT,
    '#default_value' => $config
      ->get('selected_langcode'),
  ];
  return parent::buildForm($form, $form_state);
}