public function EntityAccessByFieldPermissions::permissions in Open Social 8.5
Same name and namespace in other branches
- 8.9 modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php \Drupal\entity_access_by_field\EntityAccessByFieldPermissions::permissions()
- 8 modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php \Drupal\entity_access_by_field\EntityAccessByFieldPermissions::permissions()
- 8.2 modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php \Drupal\entity_access_by_field\EntityAccessByFieldPermissions::permissions()
- 8.3 modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php \Drupal\entity_access_by_field\EntityAccessByFieldPermissions::permissions()
- 8.4 modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php \Drupal\entity_access_by_field\EntityAccessByFieldPermissions::permissions()
- 8.6 modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php \Drupal\entity_access_by_field\EntityAccessByFieldPermissions::permissions()
- 8.7 modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php \Drupal\entity_access_by_field\EntityAccessByFieldPermissions::permissions()
- 8.8 modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php \Drupal\entity_access_by_field\EntityAccessByFieldPermissions::permissions()
- 10.3.x modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php \Drupal\entity_access_by_field\EntityAccessByFieldPermissions::permissions()
- 10.0.x modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php \Drupal\entity_access_by_field\EntityAccessByFieldPermissions::permissions()
- 10.1.x modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php \Drupal\entity_access_by_field\EntityAccessByFieldPermissions::permissions()
- 10.2.x modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php \Drupal\entity_access_by_field\EntityAccessByFieldPermissions::permissions()
Return all the permissions generated by this user.
1 string reference to 'EntityAccessByFieldPermissions::permissions'
- entity_access_by_field.permissions.yml in modules/
custom/ entity_access_by_field/ entity_access_by_field.permissions.yml - modules/custom/entity_access_by_field/entity_access_by_field.permissions.yml
File
- modules/
custom/ entity_access_by_field/ src/ EntityAccessByFieldPermissions.php, line 58
Class
- EntityAccessByFieldPermissions
- EntityAccessByFieldPermissions.
Namespace
Drupal\entity_access_by_fieldCode
public function permissions() {
$permissions = [];
$contentTypes = $this
->getContentTypes();
foreach ($contentTypes as $bundle) {
$entity_type = 'node';
$fields = $this
->getEntityAccessFields($entity_type, $bundle);
/** @var \Drupal\field\Entity\FieldConfig $field */
foreach ($fields as $field) {
$field_storage = $field
->getFieldStorageDefinition();
// @TODO Add support for allowed_values_function.
$allowed_values = $field_storage
->getSetting('allowed_values');
if (!empty($allowed_values)) {
foreach ($allowed_values as $field_key => $field_label) {
if (!in_array($field_key, $this
->getIgnoredValues())) {
// e.g. label = node.article.field_content_visibility:public.
$permission_label = $field
->id() . ':' . $field_key;
$permission = 'view ' . $permission_label . ' content';
$permissions[$permission] = [
'title' => $this
->t('View @label content', [
'@label' => $permission_label,
]),
];
}
}
}
}
}
return $permissions;
}