diff --git a/core/modules/user/src/Form/UserPermissionsForm.php b/core/modules/user/src/Form/UserPermissionsForm.php index 9bbb6b57e5308ec737a6e75b28bcdc26a76c231f..0e0a01a5e0af4e1e78e5c4fc23446818026da1ee 100644 --- a/core/modules/user/src/Form/UserPermissionsForm.php +++ b/core/modules/user/src/Form/UserPermissionsForm.php @@ -8,6 +8,7 @@ namespace Drupal\user\Form; use Drupal\Component\Utility\SafeMarkup; +use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\user\PermissionHandlerInterface; @@ -33,6 +34,13 @@ class UserPermissionsForm extends FormBase { */ protected $roleStorage; + /** + * The module handler. + * + * @var \Drupal\Core\Extension\ModuleHandlerInterface + */ + protected $moduleHandler; + /** * Constructs a new UserPermissionsForm. * @@ -40,10 +48,13 @@ class UserPermissionsForm extends FormBase { * The permission handler. * @param \Drupal\user\RoleStorageInterface $role_storage * The role storage. + * @param \Drupal\Core\Extension\ModuleHandlerInterface + * The module handler. */ - public function __construct(PermissionHandlerInterface $permission_handler, RoleStorageInterface $role_storage) { + public function __construct(PermissionHandlerInterface $permission_handler, RoleStorageInterface $role_storage, ModuleHandlerInterface $module_handler) { $this->permissionHandler = $permission_handler; $this->roleStorage = $role_storage; + $this->moduleHandler = $module_handler; } /** @@ -52,7 +63,8 @@ public function __construct(PermissionHandlerInterface $permission_handler, Role public static function create(ContainerInterface $container) { return new static( $container->get('user.permissions'), - $container->get('entity.manager')->getStorage('user_role') + $container->get('entity.manager')->getStorage('user_role'), + $container->get('module_handler') ); } @@ -95,7 +107,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { ); // Render role/permission overview: $options = array(); - $module_info = system_rebuild_module_data(); $hide_descriptions = system_admin_compact_mode(); $form['system_compact_link'] = array( @@ -131,7 +142,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { 'class' => array('module'), 'id' => 'module-' . $provider, ), - '#markup' => $module_info[$provider]->info['name'], + '#markup' => $this->moduleHandler->getName($provider), )); foreach ($permissions as $perm => $perm_item) { // Fill in default values for the permission.