You are here

public function CustomAccess::getPermissions in Field Permissions 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/FieldPermissionType/CustomAccess.php \Drupal\field_permissions\Plugin\FieldPermissionType\CustomAccess::getPermissions()

Returns an array of permissions suitable for use in a permission callback.

Return value

array An array of permissions.

Overrides CustomPermissionsInterface::getPermissions

1 call to CustomAccess::getPermissions()
CustomAccess::addPermissionsGrid in src/Plugin/FieldPermissionType/CustomAccess.php
Attach a permissions grid to the field edit form.

File

src/Plugin/FieldPermissionType/CustomAccess.php, line 103

Class

CustomAccess
Defines custom access for fields.

Namespace

Drupal\field_permissions\Plugin\FieldPermissionType

Code

public function getPermissions() {
  $permissions = [];
  $field_name = $this->fieldStorage
    ->getName();
  $permission_list = FieldPermissionsService::getList($field_name);
  $perms_name = array_keys($permission_list);
  foreach ($perms_name as $perm_name) {
    $name = $perm_name . ' ' . $field_name;
    $permissions[$name] = $permission_list[$perm_name];
  }
  return $permissions;
}