protected function PermissionProviderTrait::buildPermission in Group 2.0.x
Builds a permission with common translation arguments predefined.
Parameters
string $title: The permission title.
string $description: (optional) The permission description.
Return value
array The permission with a default translatable markup replacement for both %plugin_name and %entity_type.
2 calls to PermissionProviderTrait::buildPermission()
- FullEntityPermissionProvider::buildPermissions in tests/
modules/ group_test_plugin/ src/ Plugin/ Group/ RelationHandler/ FullEntityPermissionProvider.php - Provides a list of group permissions the plugin exposes.
- PermissionProvider::buildPermissions in src/
Plugin/ Group/ RelationHandlerDefault/ PermissionProvider.php - Provides a list of group permissions the plugin exposes.
File
- src/
Plugin/ Group/ RelationHandler/ PermissionProviderTrait.php, line 102
Class
- PermissionProviderTrait
- Trait for group relation permission providers.
Namespace
Drupal\group\Plugin\Group\RelationHandlerCode
protected function buildPermission($title, $description = NULL) {
$t_args = [
'%plugin_name' => $this->definition['label'],
'%entity_type' => $this->entityType
->getSingularLabel(),
];
$permission['title'] = $title;
$permission['title_args'] = $t_args;
if (isset($description)) {
$permission['description'] = $description;
$permission['description_args'] = $t_args;
}
return $permission;
}