2424use Drupal \Core \Discovery \YamlDiscovery ;
2525use Drupal \Core \Entity \EntityTypeManagerInterface ;
2626use Drupal \Core \Extension \ModuleHandlerInterface ;
27+ use Drupal \Core \Extension \ModuleExtensionList ;
2728use Drupal \Core \Session \AccountInterface ;
2829use Drupal \Core \StringTranslation \StringTranslationTrait ;
2930use Drupal \apigee_edge_teams \Entity \TeamInterface ;
@@ -112,6 +113,13 @@ final class TeamPermissionHandler implements TeamPermissionHandlerInterface {
112113 */
113114 private $ entityTypeManager ;
114115
116+ /**
117+ * The module extension list.
118+ *
119+ * @var \Drupal\Core\Extension\ModuleExtensionList
120+ */
121+ private $ moduleExtensionList ;
122+
115123 /**
116124 * TeamPermissionHandler constructor.
117125 *
@@ -123,12 +131,15 @@ final class TeamPermissionHandler implements TeamPermissionHandlerInterface {
123131 * The team membership manager service.
124132 * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
125133 * The entity type manager.
134+ * @param \Drupal\Core\Extension\ModuleExtensionList $module_extension_list
135+ * The module extension list.
126136 */
127- public function __construct (ModuleHandlerInterface $ module_handler , ClassResolverInterface $ class_resolver , TeamMembershipManagerInterface $ team_membership_manager , EntityTypeManagerInterface $ entity_type_manager ) {
137+ public function __construct (ModuleHandlerInterface $ module_handler , ClassResolverInterface $ class_resolver , TeamMembershipManagerInterface $ team_membership_manager , EntityTypeManagerInterface $ entity_type_manager, ModuleExtensionList $ module_extension_list ) {
128138 $ this ->moduleHandler = $ module_handler ;
129139 $ this ->classResolver = $ class_resolver ;
130140 $ this ->teamMembershipManager = $ team_membership_manager ;
131141 $ this ->entityTypeManager = $ entity_type_manager ;
142+ $ this ->moduleExtensionList = $ module_extension_list ;
132143 }
133144
134145 /**
@@ -299,7 +310,7 @@ protected function sortPermissions(array $all_permissions = []) {
299310 protected function getModuleNames (): array {
300311 $ modules = [];
301312 foreach (array_keys ($ this ->moduleHandler ->getModuleList ()) as $ module ) {
302- $ modules [$ module ] = $ this ->moduleHandler ->getName ($ module );
313+ $ modules [$ module ] = $ this ->moduleExtensionList ->getName ($ module );
303314 }
304315 asort ($ modules );
305316 return $ modules ;
0 commit comments