function AccountForm::syncUserLangcode

Same name in other branches
  1. 9 core/modules/user/src/AccountForm.php \Drupal\user\AccountForm::syncUserLangcode()
  2. 8.9.x core/modules/user/src/AccountForm.php \Drupal\user\AccountForm::syncUserLangcode()
  3. 11.x core/modules/user/src/AccountForm.php \Drupal\user\AccountForm::syncUserLangcode()

Synchronizes preferred language and entity language.

Parameters

string $entity_type_id: The entity type identifier.

\Drupal\user\UserInterface $user: The entity updated with the submitted values.

array $form: The complete form array.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

File

core/modules/user/src/AccountForm.php, line 354

Class

AccountForm
Form controller for the user account forms.

Namespace

Drupal\user

Code

public function syncUserLangcode($entity_type_id, UserInterface $user, array &$form, FormStateInterface &$form_state) {
    $user->getUntranslated()->langcode = $user->preferred_langcode;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.