Commit e1c4a8c9 authored by minorOffense's avatar minorOffense Committed by Ra Mänd
Browse files

Issue #3054682 by minorOffense: field_collection_item_access not calling...

Issue #3054682 by minorOffense: field_collection_item_access not calling entity_access with correct arguments
parent 605e0e4e
...@@ -375,10 +375,13 @@ function field_collection_item_access($op, FieldCollectionItemEntity $item = NUL ...@@ -375,10 +375,13 @@ function field_collection_item_access($op, FieldCollectionItemEntity $item = NUL
return FALSE; return FALSE;
} }
$op = $op == 'view' ? 'view' : 'edit'; $op = $op == 'view' ? 'view' : 'edit';
// Access is determined by the entity and field containing the reference. // Access is determined by the entity and field containing the reference.
$field = field_info_field($item->field_name); $field = field_info_field($item->field_name);
$entity_access = entity_access($op == 'view' ? 'view' : 'update', $item->hostEntityType(), $item->hostEntity(), $account); $hostEntity = $item->hostEntity() !== FALSE ? $item->hostEntity() : NULL;
return $entity_access && field_access($op, $field, $item->hostEntityType(), $item->hostEntity(), $account); $entity_access = entity_access($op == 'view' ? 'view' : 'update', $item->hostEntityType(), $hostEntity, $account);
return $entity_access && field_access($op, $field, $item->hostEntityType(), $hostEntity, $account);
} }
/** /**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment