Skip to content

Instantly share code, notes, and snippets.

@maestrojed
Created February 15, 2019 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maestrojed/4dbc53b30e738fb9cd0036fff9dfef08 to your computer and use it in GitHub Desktop.
Save maestrojed/4dbc53b30e738fb9cd0036fff9dfef08 to your computer and use it in GitHub Desktop.
<?php
use Drupal\Core\Extension\ModuleHandlerInterface;
class PermissionHandler implements PermissionHandlerInterface {
/** SOME OTHER METHODS REMOVED TO BE CONSISE. **/
/**
* Returns all module names.
*
* @return string[]
* Returns the human readable names of all modules keyed by machine name.
*/
protected function getModuleNames() {
$modules = [];
foreach (array_keys($this->moduleHandler->getModuleList()) as $module) {
$modules[$module] = $this->moduleHandler->getName($module);
}
asort($modules);
return $modules;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment