public function EntityLegalPermissions::permissions in Entity Legal 8.2
Same name and namespace in other branches
- 4.0.x src/EntityLegalPermissions.php \Drupal\entity_legal\EntityLegalPermissions::permissions()
- 3.0.x src/EntityLegalPermissions.php \Drupal\entity_legal\EntityLegalPermissions::permissions()
Returns an array of entity legal document permissions.
Return value
array The entity legal document permissions.
See also
\Drupal\user\PermissionHandlerInterface::getPermissions()
1 string reference to 'EntityLegalPermissions::permissions'
File
- src/
EntityLegalPermissions.php, line 23
Class
- EntityLegalPermissions
- Provides dynamic permissions for nodes of different types.
Namespace
Drupal\entity_legalCode
public function permissions() {
$perms = [];
/** @var \Drupal\entity_legal\Entity\EntityLegalDocument $document */
foreach (EntityLegalDocument::loadMultiple() as $document) {
$perms[$document
->getPermissionView()] = [
'title' => $this
->t('View "@name"', [
'@name' => $document
->id(),
]),
'description' => $this
->t('Allow users to view the legal document.'),
];
$perms[$document
->getPermissionExistingUser()] = [
'title' => $this
->t('Re-accept "@name"', [
'@name' => $document
->id(),
]),
'description' => $this
->t('Existing user roles that must re-accept the legal document.'),
];
}
return $perms;
}