You are here

function ds_extras_ds_field_access in Display Suite 8.2

Same name and namespace in other branches
  1. 8.4 modules/ds_extras/ds_extras.module \ds_extras_ds_field_access()
  2. 8.3 modules/ds_extras/ds_extras.module \ds_extras_ds_field_access()
  3. 7.2 modules/ds_extras/ds_extras.module \ds_extras_ds_field_access()

Check DS fields access.

Parameters

string $field: The machine name of the field

string $entity_type: The name of the entity type.

Return value

bool TRUE if the user has access to view this field in this entity type, FALSE otherwise.

1 call to ds_extras_ds_field_access()
ds_entity_view_alter in ./ds.module
Implements hook_entity_view_alter().
1 string reference to 'ds_extras_ds_field_access'
ds_entity_view_alter in ./ds.module
Implements hook_entity_view_alter().

File

modules/ds_extras/ds_extras.module, line 333
Display Suite extras main functions.

Code

function ds_extras_ds_field_access($field, $entity_type) {
  if (\Drupal::currentUser()
    ->hasPermission('view ' . $field . ' on ' . $entity_type)) {
    return TRUE;
  }
  return FALSE;
}