diff -u b/core/modules/field/field.api.php b/core/modules/field/field.api.php --- b/core/modules/field/field.api.php +++ b/core/modules/field/field.api.php @@ -2139,7 +2139,7 @@ * * @param $op * The operation to be performed. Possible values: 'edit', 'view'. - * @param $field + * @param \Drupal\field\FieldInterface $field * The field on which the operation is to be performed. * @param $entity_type * The type of $entity; for example, 'node' or 'user'. @@ -2151,7 +2151,7 @@ * @return * TRUE if the operation is allowed, and FALSE if the operation is denied. */ -function hook_field_access($op, $field, $entity_type, $entity, $account) { +function hook_field_access($op, \Drupal\field\FieldInterface $field, $entity_type, $entity, $account) { if ($field['field_name'] == 'field_of_interest' && $op == 'edit') { return user_access('edit field of interest', $account); } only in patch2: unchanged: --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -6,6 +6,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Template\Attribute; +use Drupal\field\FieldInterface; /* * Load all public Field API functions. Drupal currently has no @@ -944,9 +945,8 @@ function field_has_data($field) { * The operation to be performed. Possible values: * - edit * - view - * @param array $field - * The full field structure array for the field on which the operation is to - * be performed. See field_info_field(). + * @param \Drupal\field\FieldInterface $field + * The field on which the operation is to be performed. * @param $entity_type * The type of $entity; for example, 'node' or 'user'. * @param $entity @@ -957,7 +957,7 @@ function field_has_data($field) { * @return * TRUE if the operation is allowed; FALSE if the operation is denied. */ -function field_access($op, $field, $entity_type, $entity = NULL, $account = NULL) { +function field_access($op, FieldInterface $field, $entity_type, $entity = NULL, $account = NULL) { global $user; if (!isset($account)) { only in patch2: unchanged: --- a/core/modules/field/tests/modules/field_test/field_test.field.inc +++ b/core/modules/field/tests/modules/field_test/field_test.field.inc @@ -7,6 +7,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\field\FieldException; +use Drupal\field\FieldInterface; /** * Implements hook_field_info(). @@ -197,7 +198,7 @@ function field_test_default_value(EntityInterface $entity, $field, $instance) { /** * Implements hook_field_access(). */ -function field_test_field_access($op, $field, $entity_type, $entity, $account) { +function field_test_field_access($op, FieldInterface $field, $entity_type, $entity, $account) { if ($field['field_name'] == "field_no_{$op}_access") { return FALSE; }