| Versionen | |
|---|---|
| drupal7 | field_access($op, $field, $account = NULL) |
Determine whether the user has access to a given field.
$op The operation to be performed. Possible values:
$field The field on which the operation is to be performed.
$account (optional) The account to check, if not given use currently logged in user.
TRUE if the operation is allowed; FALSE if the operation is denied.
modules/
<?php
function field_access($op, $field, $account = NULL) {
global $user;
if (is_null($account)) {
$account = $user;
}
$field_access = module_invoke_all('field_access', $op, $field, $account);
foreach ($field_access as $value) {
if ($value === FALSE) {
return FALSE;
}
}
return TRUE;
}
?>
Kommentare
Kommentar hinzufügen