diff --git a/core/modules/user/lib/Drupal/user/AccountFormController.php b/core/modules/user/lib/Drupal/user/AccountFormController.php index 16c870e..43f2f7f 100644 --- a/core/modules/user/lib/Drupal/user/AccountFormController.php +++ b/core/modules/user/lib/Drupal/user/AccountFormController.php @@ -10,6 +10,7 @@ use Drupal\Core\Entity\EntityFormController; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageManager; use Drupal\Core\Entity\EntityControllerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -26,24 +27,32 @@ protected $moduleHandler; /** + * The language manager. + * + * @var \Drupal\Core\Language\LanguageManager + */ + protected $languageManager; + + /** * Constructs a new EntityFormController object. * * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke hooks on. + * @param \Drupal\Core\Language\LanguageManager $language_manager + * The language manager. */ - public function __construct($operation, ModuleHandlerInterface $module_handler) { - parent::__construct($operation); - + public function __construct(ModuleHandlerInterface $module_handler, LanguageManager $language_manager) { $this->moduleHandler = $module_handler; + $this->languageManager = $language_manager; } /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info, $operation = NULL) { + public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info) { return new static( - $operation, - $container->get('module_handler') + $container->get('module_handler'), + $container->get('language_manager') ); } @@ -216,7 +225,7 @@ public function form(array $form, array &$form_state) { include_once DRUPAL_ROOT . '/core/includes/language.inc'; $interface_language_is_default = language_negotiation_method_get_first(Language::TYPE_INTERFACE) != LANGUAGE_NEGOTIATION_SELECTED; $form['language'] = array( - '#type' => language_multilingual() ? 'details' : 'container', + '#type' => $this->languageManager->isMultilingual() ? 'details' : 'container', '#title' => t('Language settings'), // Display language selector when either creating a user on the admin // interface or editing a user account. @@ -235,7 +244,7 @@ public function form(array $form, array &$form_state) { // if one of the detection and selection methods uses it. if ($this->moduleHandler->moduleExists('language')) { $show_admin_language = FALSE; - if (language_multilingual()) { + if ($this->languageManager->isMultilingual() ) { 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])) {