You are here

public function BasicForm::buildForm in Admin User Language 8

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/BasicForm.php, line 67

Class

BasicForm
Class BasicForm.

Namespace

Drupal\admin_user_language\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('admin_user_language.settings');
  $form['default_language_to_assign'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Default language to assign'),
    '#description' => $this
      ->t('Select a default administration language to assign on user registration/update.'),
    '#options' => $this
      ->getActiveLanguages(),
    '#size' => 1,
    '#default_value' => $config
      ->get('default_language_to_assign'),
  ];
  $form['prevent_user_override'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Force language'),
    '#description' => $this
      ->t('Activating this option a user will not be able to save its chosen administration language.'),
    '#default_value' => $config
      ->get('prevent_user_override'),
  ];
  return parent::buildForm($form, $form_state);
}