summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2015-05-20 12:13:40 +0100
committerAlex Pott2015-05-20 12:13:40 +0100
commit241def35490fdb5dfac5a4d46cd139959fd973e6 (patch)
treea1f4f3aa4cd4322257317a2ca34e11daf41efe72
parent0f1a044e09427ac1d135eb91598543a73d0ef78c (diff)
Issue #2488610 by catch, kim.pepper, Berdir: Use ModuleHander::getName() instead of rebuilding module data on permissions page
-rw-r--r--core/modules/user/src/Form/UserPermissionsForm.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/core/modules/user/src/Form/UserPermissionsForm.php b/core/modules/user/src/Form/UserPermissionsForm.php
index 9bbb6b5..0e0a01a 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;
@@ -34,16 +35,26 @@ class UserPermissionsForm extends FormBase {
protected $roleStorage;
/**
+ * The module handler.
+ *
+ * @var \Drupal\Core\Extension\ModuleHandlerInterface
+ */
+ protected $moduleHandler;
+
+ /**
* Constructs a new UserPermissionsForm.
*
* @param \Drupal\user\PermissionHandlerInterface $permission_handler
* 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 @@ class UserPermissionsForm extends FormBase {
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 @@ class UserPermissionsForm extends FormBase {
);
// 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 @@ class UserPermissionsForm extends FormBase {
'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.