diff --git a/core/modules/user/lib/Drupal/user/AccountFormController.php b/core/modules/user/lib/Drupal/user/AccountFormController.php index f54ad6a..16c870e 100644 --- a/core/modules/user/lib/Drupal/user/AccountFormController.php +++ b/core/modules/user/lib/Drupal/user/AccountFormController.php @@ -2,22 +2,53 @@ /** * @file - * Definition of Drupal\user\AccountFormController. + * Contains \Drupal\user\AccountFormController. */ namespace Drupal\user; -use Drupal; use Drupal\Core\Entity\EntityFormController; +use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\Language; +use Drupal\Core\Entity\EntityControllerInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Form controller for the user account forms. */ -abstract class AccountFormController extends EntityFormController { +abstract class AccountFormController extends EntityFormController implements EntityControllerInterface { /** - * Overrides Drupal\Core\Entity\EntityFormController::form(). + * The module handler to invoke hooks on. + * + * @var \Drupal\Core\Extension\ModuleHandlerInterface + */ + protected $moduleHandler; + + /** + * Constructs a new EntityFormController object. + * + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler + * The module handler to invoke hooks on. + */ + public function __construct($operation, ModuleHandlerInterface $module_handler) { + parent::__construct($operation); + + $this->moduleHandler = $module_handler; + } + + /** + * {@inheritdoc} + */ + public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info, $operation = NULL) { + return new static( + $operation, + $container->get('module_handler') + ); + } + + /** + * Overrides \Drupal\Core\Entity\EntityFormController::form(). */ public function form(array $form, array &$form_state) { $account = $this->entity; @@ -202,7 +233,7 @@ public function form(array $form, array &$form_state) { // Only show the account setting for Administration pages language to users // if one of the detection and selection methods uses it. - if (\Drupal::moduleHandler()->moduleExists('language')) { + if ($this->moduleHandler->moduleExists('language')) { $show_admin_language = FALSE; if (language_multilingual()) { foreach (language_types_info() as $type_key => $language_type) {