public function RabbitHolePermissionGenerator::permissions in Rabbit Hole 8
Same name and namespace in other branches
- 2.x src/RabbitHolePermissionGenerator.php \Drupal\rabbit_hole\RabbitHolePermissionGenerator::permissions()
Return an array of per-entity rabbit hole permissions.
Return value
array An array of permissions.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
1 string reference to 'RabbitHolePermissionGenerator::permissions'
File
- src/
RabbitHolePermissionGenerator.php, line 66
Class
- RabbitHolePermissionGenerator
- Generates permission for each supported entity type.
Namespace
Drupal\rabbit_holeCode
public function permissions() {
$permissions = [];
foreach ($this->rhEntityPluginManager
->getDefinitions() as $def) {
$entity_type = $this->entityTypeManager
->getStorage($def['entityType'])
->getEntityType();
$permissions += [
'rabbit hole administer ' . $def['entityType'] => [
'title' => $this
->t('Administer Rabbit Hole settings for %entity_type', [
'%entity_type' => $entity_type
->getLabel(),
]),
],
'rabbit hole bypass ' . $def['entityType'] => [
'title' => $this
->t('Bypass Rabbit Hole action for %entity_type', [
'%entity_type' => $entity_type
->getLabel(),
]),
],
];
}
return $permissions;
}