You are here

function l10n_client_contributor_entity_field_access in Localization client 8

Implements hook_entity_field_access().

File

l10n_client_contributor/l10n_client_contributor.module, line 120
Submits translations to a remote localization server.

Code

function l10n_client_contributor_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {

  // Never allow viewing the API key on an entity.
  if ($field_definition
    ->getFieldStorageDefinition()
    ->getType() == 'l10n_client_contributor_key' && $operation == 'view') {
    return AccessResult::forbidden();
  }
  return AccessResult::neutral();
}