Determine whether the user has access to a given field.
This hook is invoked from field_access() to let modules block access to operations on fields. If no module returns FALSE, the operation is allowed.
$op: The operation to be performed. Possible values: 'edit', 'view'.
$field: The field on which the operation is to be performed.
$entity_type: The type of $entity; for example, 'node' or 'user'.
$entity: (optional) The entity for the operation.
$account: (optional) The account to check; if not given use currently logged in user.
TRUE if the operation is allowed, and FALSE if the operation is denied.
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_field_access($op, $field, $entity_type, $entity, $account) {
if ($field['field_name'] == 'field_of_interest' && $op == 'edit') {
return user_access('edit field of interest', $account);
}
return TRUE;
}