only in patch2: unchanged: --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -92,7 +92,7 @@ function field_help($route_name, RouteMatchInterface $route_match) { // enabled, ordered by displayed module name (module names are not // translated). $items = array(); - $info = system_get_info('module'); + $modules = \Drupal::moduleHandler()->getModuleList(); $widgets = \Drupal::service('plugin.manager.field.widget')->getDefinitions(); $field_types = \Drupal::service('plugin.manager.field.field_type')->getUiDefinitions(); $formatters = \Drupal::service('plugin.manager.field.formatter')->getDefinitions(); @@ -105,8 +105,8 @@ function field_help($route_name, RouteMatchInterface $route_match) { foreach ($providers as $provider) { // Skip plugins provided by core components as they do not implement // hook_help(). - if (isset($info[$provider]['name'])) { - $display = $info[$provider]['name']; + if (isset($modules[$provider])) { + $display = \Drupal::moduleHandler()->getName($provider); if (\Drupal::moduleHandler()->implementsHook($provider, 'help')) { $items[] = \Drupal::l($display, new Url('help.page', array('name' => $provider))); } only in patch2: unchanged: --- a/core/modules/help/src/Controller/HelpController.php +++ b/core/modules/help/src/Controller/HelpController.php @@ -118,12 +118,11 @@ protected function helpLinksAsList() { public function helpPage($name) { $build = array(); if ($this->moduleHandler()->implementsHook($name, 'help')) { - $info = system_get_info('module'); $build['#title'] = SafeMarkup::checkPlain($info[$name]['name']); $temp = $this->moduleHandler()->invoke($name, 'help', array("help.page.$name", $this->routeMatch)); if (empty($temp)) { - $build['top']['#markup'] = $this->t('No help is available for module %module.', array('%module' => $info[$name]['name'])); + $build['top']['#markup'] = $this->t('No help is available for module %module.', array('%module' =>$this->moduleHandler()->getName($name)); } else { $build['top']['#markup'] = $temp; only in patch2: unchanged: --- a/core/modules/user/src/Plugin/views/access/Permission.php +++ b/core/modules/user/src/Plugin/views/access/Permission.php @@ -8,6 +8,7 @@ namespace Drupal\user\Plugin\views\access; use Drupal\Component\Utility\SafeMarkup; +use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Session\AccountInterface; use Drupal\user\PermissionHandlerInterface; @@ -41,6 +42,13 @@ class Permission extends AccessPluginBase { protected $permissionHandler; /** + * The module handler. + * + * @var \Drupal\Core\Extension\ModuleHandlerInterface + */ + protected $moduleHandler; + + /** * Constructs a Permission object. * * @param array $configuration @@ -51,10 +59,13 @@ class Permission extends AccessPluginBase { * The plugin implementation definition. * @param \Drupal\user\PermissionHandlerInterface $permission_handler * The permission handler. + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler + * The module handler. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, PermissionHandlerInterface $permission_handler) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, PermissionHandlerInterface $permission_handler, ModuleHandlerInterface $module_handler) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->permissionHandler = $permission_handler; + $this->moduleHandler = $module_handler; } /** @@ -65,7 +76,8 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('user.permissions') + $container->get('user.permissions'), + $container->get('module_handler') ); } @@ -102,14 +114,12 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); - $module_info = system_get_info('module'); - // Get list of permissions $perms = []; $permissions = $this->permissionHandler->getPermissions(); foreach ($permissions as $perm => $perm_item) { $provider = $perm_item['provider']; - $display_name = $module_info[$provider]['name']; + $display_name = $this->moduleHandler->getName($provider); $perms[$display_name][$perm] = SafeMarkup::checkPlain(strip_tags($perm_item['title'])); } only in patch2: unchanged: --- a/core/modules/user/src/Plugin/views/field/UserData.php +++ b/core/modules/user/src/Plugin/views/field/UserData.php @@ -7,6 +7,7 @@ namespace Drupal\user\Plugin\views\field; +use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\views\Plugin\views\display\DisplayPluginBase; use Drupal\views\Plugin\views\field\FieldPluginBase; @@ -34,19 +35,28 @@ class UserData extends FieldPluginBase { protected $userData; /** + * The module handler. + * + * @var \Drupal\Core\Extension\ModuleHandlerInterface + */ + protected $moduleHandler; + + + /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static($configuration, $plugin_id, $plugin_definition, $container->get('user.data')); + return new static($configuration, $plugin_id, $plugin_definition, $container->get('user.data'), $container->get('module_handler')); } /** * Constructs a UserData object. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, UserDataInterface $user_data) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, UserDataInterface $user_data, ModuleHandlerInterface $module_handler) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->userData = $user_data; + $this->moduleHandler = $module_handler; } /** @@ -67,10 +77,10 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); - $modules = system_get_info('module'); + $modules = $this->moduleHandler->getModuleList(); $names = array(); - foreach ($modules as $name => $module) { - $names[$name] = $module['name']; + foreach (array_keys($modules) as $name) { + $names[$name] = $this->moduleHandler->getName($name); } $form['data_module'] = array( only in patch2: unchanged: --- a/core/modules/user/src/Plugin/views/filter/Permissions.php +++ b/core/modules/user/src/Plugin/views/filter/Permissions.php @@ -30,6 +30,13 @@ class Permissions extends ManyToOne { protected $permissionHandler; /** + * The module handler. + * + * @var \Drupal\user\ModuleHandlerInterface + */ + protected $moduleHandler; + + /** * Constructs a Permissions object. * * @param array $configuration @@ -40,11 +47,14 @@ class Permissions extends ManyToOne { * The plugin implementation definition. * @param \Drupal\user\PermissionHandlerInterface $permission_handler * The permission handler. + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler + * The module handler. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, PermissionHandlerInterface $permission_handler) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, PermissionHandlerInterface $permission_handler, ModuleHandlerInterface $module_handler) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->permissionHandler = $permission_handler; + $this->moduleHandler = $module_handler; } /** @@ -55,18 +65,17 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('user.permissions') + $container->get('user.permissions'), + $container->get('module_handler') ); } public function getValueOptions() { if (!isset($this->valueOptions)) { - $module_info = system_get_info('module'); - $permissions = $this->permissionHandler->getPermissions(); foreach ($permissions as $perm => $perm_item) { $provider = $perm_item['provider']; - $display_name = $module_info[$provider]['name']; + $display_name = $this->moduleHandler->getName($provider); $this->valueOptions[$display_name][$perm] = SafeMarkup::checkPlain(strip_tags($perm_item['title'])); } }