Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save cyberlex404/95e958f1c0ee76bf9b81dc3bd5eae1b6 to your computer and use it in GitHub Desktop.

Select an option

Save cyberlex404/95e958f1c0ee76bf9b81dc3bd5eae1b6 to your computer and use it in GitHub Desktop.
/**
* @inheritDoc
*/
protected function checkFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
$administrative_fields = ['housing'];
if ($operation == 'edit' && in_array($field_definition->getName(), $administrative_fields, TRUE)) {
return AccessResult::allowedIfHasPermission($account, 'administer housing gallery entities');
}
return parent::checkFieldAccess($operation, $field_definition, $account, $items); // TODO: Change the autogenerated stub
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment