class EntityLegalPermissions in Entity Legal 8.2
Same name and namespace in other branches
- 4.0.x src/EntityLegalPermissions.php \Drupal\entity_legal\EntityLegalPermissions
- 3.0.x src/EntityLegalPermissions.php \Drupal\entity_legal\EntityLegalPermissions
Provides dynamic permissions for nodes of different types.
Hierarchy
- class \Drupal\entity_legal\EntityLegalPermissions uses StringTranslationTrait
Expanded class hierarchy of EntityLegalPermissions
File
- src/
EntityLegalPermissions.php, line 11
Namespace
Drupal\entity_legalView source
class EntityLegalPermissions {
use StringTranslationTrait;
/**
* Returns an array of entity legal document permissions.
*
* @return array
* The entity legal document permissions.
*
* @see \Drupal\user\PermissionHandlerInterface::getPermissions()
*/
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;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityLegalPermissions:: |
public | function | Returns an array of entity legal document permissions. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |