public function FieldUiPermissions::fieldPermissions in Drupal 8
Same name and namespace in other branches
- 9 core/modules/field_ui/src/FieldUiPermissions.php \Drupal\field_ui\FieldUiPermissions::fieldPermissions()
Returns an array of field UI permissions.
Return value
array
1 string reference to 'FieldUiPermissions::fieldPermissions'
- field_ui.permissions.yml in core/
modules/ field_ui/ field_ui.permissions.yml - core/modules/field_ui/field_ui.permissions.yml
File
- core/
modules/ field_ui/ src/ FieldUiPermissions.php, line 53
Class
- FieldUiPermissions
- Provides dynamic permissions of the field_ui module.
Namespace
Drupal\field_uiCode
public function fieldPermissions() {
$permissions = [];
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type_id => $entity_type) {
if ($entity_type
->get('field_ui_base_route')) {
// Create a permission for each fieldable entity to manage
// the fields and the display.
$permissions['administer ' . $entity_type_id . ' fields'] = [
'title' => $this
->t('%entity_label: Administer fields', [
'%entity_label' => $entity_type
->getLabel(),
]),
'restrict access' => TRUE,
];
$permissions['administer ' . $entity_type_id . ' form display'] = [
'title' => $this
->t('%entity_label: Administer form display', [
'%entity_label' => $entity_type
->getLabel(),
]),
];
$permissions['administer ' . $entity_type_id . ' display'] = [
'title' => $this
->t('%entity_label: Administer display', [
'%entity_label' => $entity_type
->getLabel(),
]),
];
}
}
return $permissions;
}