diff --git a/core/includes/entity.api.php b/core/includes/entity.api.php index 2621562..332a66d 100644 --- a/core/includes/entity.api.php +++ b/core/includes/entity.api.php @@ -416,19 +416,16 @@ function hook_entity_field_info_alter(&$info, $entity_type) { * This hook is invoked from Field::access() to let modules alter access to * operations on fields. * - * @todo: This hook will replace hook_field_access() after all field access - * checks are converted to this new API. - * * @param bool $access * Access flag reference that can be altered. TRUE if the operation is * allowed, and FALSE if the operation is denied. * @param array $context * Context array on the performed operation with the following keys: - * - access: the original access flag from the default implementation + * - access: The original access flag from the default implementation * (boolean). - * - operation: either "view" or "edit" (string). - * - field: the field object (\Drupal\Core\Entity\Field\Type\Field). - * - account: the user account to check access for + * - operation: Either "view" or "edit" (string). + * - field: The entity field object (\Drupal\Core\Entity\Field\Type\Field). + * - account: The user account to check access for * (Drupal\user\Plugin\Core\Entity\User). */ function hook_entity_field_access_alter(&$access, array $context) { diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/FieldAccessTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/FieldAccessTest.php index c2ca5fa..9a3c490 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/FieldAccessTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/FieldAccessTest.php @@ -7,19 +7,19 @@ namespace Drupal\system\Tests\Entity; -use Drupal\simpletest\WebTestBase; +use Drupal\simpletest\DrupalUnitTestBase; /** * Tests the functionality of field access. */ -class FieldAccessTest extends WebTestBase { +class FieldAccessTest extends DrupalUnitTestBase { /** * Modules to enable. * * @var array */ - public static $modules = array('entity_test'); + public static $modules = array('entity_test', 'field', 'field_sql_storage', 'system', 'text'); public static function getInfo() { return array( @@ -29,6 +29,15 @@ public static function getInfo() { ); } + protected function setUp() { + parent::setUp(); + // Install field module schema. + $this->enableModules(array('field')); + // Execute the install hook to register the text field. + module_load_install('entity_test'); + entity_test_install(); + } + /** * Tests that hook_entity_field_access_alter() is called. *