public function EntityPermissions::buildPermissions in Entity API 8
Builds a list of permissions for the participating entity types.
Return value
array The permissions.
1 string reference to 'EntityPermissions::buildPermissions'
File
- src/
EntityPermissions.php, line 49
Class
- EntityPermissions
- Generates entity permissions via their permission providers.
Namespace
Drupal\entityCode
public function buildPermissions() {
$permissions = [];
/** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type) {
if ($entity_type
->hasHandlerClass('permission_provider')) {
$permission_provider_class = $entity_type
->getHandlerClass('permission_provider');
$permission_provider = $this->entityTypeManager
->createHandlerInstance($permission_provider_class, $entity_type);
$permissions += $permission_provider
->buildPermissions($entity_type);
}
}
return $permissions;
}