You are here

public function NegotiationSessionForm::buildForm in Drupal 8

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

Class

NegotiationSessionForm
Configure the session 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['language_negotiation_session_param'] = [
    '#title' => $this
      ->t('Request/session parameter'),
    '#type' => 'textfield',
    '#default_value' => $config
      ->get('session.parameter'),
    '#description' => $this
      ->t('Name of the request/session parameter used to determine the desired language.'),
  ];
  $form_state
    ->setRedirect('language.negotiation');
  return parent::buildForm($form, $form_state);
}