- Patch #672494 by catch: small performance optimization for field_access().

merge-requests/26/head
Dries Buytaert 2010-01-02 18:50:51 +00:00
parent 8f6e5a4679
commit 2872570581
1 changed files with 5 additions and 4 deletions

View File

@ -704,13 +704,14 @@ function field_has_data($field) {
function field_access($op, $field, $obj_type, $object = NULL, $account = NULL) {
global $user;
if (is_null($account)) {
if (!isset($account)) {
$account = $user;
}
$field_access = module_invoke_all('field_access', $op, $field, $obj_type, $object, $account);
foreach ($field_access as $value) {
if ($value === FALSE) {
foreach (module_implements('field_access') as $module) {
$function = $module . '_field_access';
$access = $function($op, $field, $obj_type, $object, $account);
if ($access === FALSE) {
return FALSE;
}
}