You are here

public static function FieldPermissionsService::getList in Field Permissions 8.2

Same name and namespace in other branches
  1. 8 src/FieldPermissionsService.php \Drupal\field_permissions\FieldPermissionsService::getList()

Obtain the list of field permissions.

@todo This is really only releavant to the custom field permission type plugin. However, since it is used in the report page, it would be difficult to abstract down to the plugin level the way the report currently works.

Parameters

string $field_label: The human readable name of the field to use when constructing permission names. Usually this will be derived from one or more of the field instance labels.

Return value

array An array keyed by the permission machine name, with label and description keys. Note that this machine name doesn't include the field name.

Overrides FieldPermissionsServiceInterface::getList

1 call to FieldPermissionsService::getList()
CustomAccess::getPermissions in src/Plugin/FieldPermissionType/CustomAccess.php
Returns an array of permissions suitable for use in a permission callback.

File

src/FieldPermissionsService.php, line 62

Class

FieldPermissionsService
The field permission service.

Namespace

Drupal\field_permissions

Code

public static function getList($field_label = '') {
  return [
    'create' => [
      'label' => t('Create field'),
      'title' => t('Create own value for field @field', [
        '@field' => $field_label,
      ]),
    ],
    'edit own' => [
      'label' => t('Edit own field'),
      'title' => t('Edit own value for field @field', [
        '@field' => $field_label,
      ]),
    ],
    'edit' => [
      'label' => t('Edit field'),
      'title' => t("Edit anyone's value for field @field", [
        '@field' => $field_label,
      ]),
    ],
    'view own' => [
      'label' => t('View own field'),
      'title' => t('View own value for field @field', [
        '@field' => $field_label,
      ]),
    ],
    'view' => [
      'label' => t('View field'),
      'title' => t("View anyone's value for field @field", [
        '@field' => $field_label,
      ]),
    ],
  ];
}