field_access
- Versions
- 7
field_access($op, $field, $obj_type, $object = NULL, $account = NULL)
Determine whether the user has access to a given field.
Parameters
$op The operation to be performed. Possible values:
- "edit"
- "view"
$field The field on which the operation is to be performed.
$obj_type The type of $object; e.g. 'node' or 'user'.
$object (optional) The object for the operation.
$account (optional) The account to check, if not given use currently logged in user.
Return value
TRUE if the operation is allowed; FALSE if the operation is denied.
Related topics
Code
modules/field/field.module, line 643
<?php
function field_access($op, $field, $obj_type, $object = NULL, $account = NULL) {
global $user;
if (is_null($account)) {
$account = $user;
}
$field_access = module_invoke_all('field_access', $op, $field, $obj_type, $object, $account);
foreach ($field_access as $value) {
if ($value === FALSE) {
return FALSE;
}
}
return TRUE;
}
?>Login or register to post comments 