diff --git a/core/modules/user/lib/Drupal/user/AccountFormController.php b/core/modules/user/lib/Drupal/user/AccountFormController.php index 138b86e..1e38413 100644 --- a/core/modules/user/lib/Drupal/user/AccountFormController.php +++ b/core/modules/user/lib/Drupal/user/AccountFormController.php @@ -200,12 +200,23 @@ public function form(array $form, array &$form_state) { '#description' => $interface_language_is_default ? $this->t("This account's preferred language for e-mails and site presentation.") : $this->t("This account's preferred language for e-mails."), ); + // Only show the account setting for Administration pages language to users + // if one of the detection and selection methods uses it. + $show_admin_language = FALSE; + if (\Drupal::moduleHandler()->moduleExists('language') && language_multilingual()) { + foreach (language_types_info() as $type_key => $language_type) { + $negotiation_settings = variable_get("language_negotiation_{$type_key}", array()); + if ($show_admin_language = isset($negotiation_settings[LANGUAGE_NEGOTIATION_USER_ADMIN])) { + break; + } + } + } $form['language']['preferred_admin_langcode'] = array( '#type' => 'language_select', '#title' => $this->t('Administration pages language'), '#languages' => Language::STATE_CONFIGURABLE, '#default_value' => $user_preferred_admin_langcode, - '#access' => user_access('access administration pages', $account), + '#access' => $show_admin_language && user_access('access administration pages', $account), ); // User entities contain both a langcode property (for identifying the