function PermissionHandler::getModuleNames

Same name in other branches
  1. 9 core/modules/user/src/PermissionHandler.php \Drupal\user\PermissionHandler::getModuleNames()
  2. 8.9.x core/modules/user/src/PermissionHandler.php \Drupal\user\PermissionHandler::getModuleNames()
  3. 11.x 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.

1 call to PermissionHandler::getModuleNames()
PermissionHandler::sortPermissions in core/modules/user/src/PermissionHandler.php
Sorts the given permissions by provider name and title.

File

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

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->moduleExtensionList
            ->getName($module);
    }
    asort($modules);
    return $modules;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.