You are here

protected function PermissionHandler::getModuleNames in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/user/src/PermissionHandler.php \Drupal\user\PermissionHandler::getModuleNames()
  2. 9 core/modules/user/src/PermissionHandler.php \Drupal\user\PermissionHandler::getModuleNames()

Returns all module names.

Return value

string[] Returns the human readable names of all modules keyed by machine name.

File

core/modules/user/src/PermissionHandler.php, line 227

Class

PermissionHandler
Provides the available permissions based on yml files.

Namespace

Drupal\user

Code

protected function getModuleNames() {
  $modules = [];
  foreach (array_keys($this->moduleHandler
    ->getModuleList()) as $module) {
    $modules[$module] = $this->moduleHandler
      ->getName($module);
  }
  asort($modules);
  return $modules;
}