field_group_test.module in Field Group 8.3
Same filename and directory in other branches
Fieldgroup test module.
File
tests/modules/field_group_test/field_group_test.moduleView source
<?php
/**
* @file
* Fieldgroup test module.
*/
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Session\AccountInterface;
/**
* Implements hook_entity_field_access().
*/
function field_group_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
// Set access to false for field_no_access.
if ($operation == 'view' && $field_definition
->getName() == 'field_no_access') {
return AccessResult::forbidden();
}
return AccessResult::neutral();
}
Functions
Name | Description |
---|---|
field_group_test_entity_field_access | Implements hook_entity_field_access(). |