Commit 241def35 authored by alexpott's avatar alexpott

Issue #2488610 by catch, kim.pepper, Berdir: Use ModuleHander::getName()...

Issue #2488610 by catch, kim.pepper, Berdir: Use ModuleHander::getName() instead of rebuilding module data on permissions page
parent 0f1a044e
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment