Closed (fixed)
Project:
Entity Collection
Version:
7.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Apr 2017 at 14:19 UTC
Updated:
23 May 2017 at 06:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
svenryen commentedThe attached patch fixes the issue by checking the entities with `entity_access('view', ...)` before returning the output. This way, we will always have a consistent number of entities shown in a panel pane.
I have also thought of the possibility that the entity collection would be split over several panes, so in that case it checks the visibility of all entities from the beginning of the collection.
Comment #3
svenryen commentedComment #4
esolitosIt seems to me that the patch only considers 1 level of depth when counting?
On top of that i see a performance issue, for every item a
foreachon all children is added which calls anentity_accessin the itea, and the same call is then called again inrenderTreeNode.Maybe we can re-work how the
ECStyleHierarchyLimitedhandles the limits.Comment #5
svenryen commentedWhen the items are displayed on a page, only the first level is counted - any additional levels are ignored in the logic that figures out which elements to display in a pane, which is why I check only the first level.
Performance isn't affected. The result of entity_access is cached, so when it's called the consecutive times on all children it doesn't hit the database, which is also the case for the call in renderTreeNode.
You can also see on line 57 there's a fix for the performance issue you are implying.
if ($visible_items == $limitation['length']) {which will cause the loop to stop after it's checked the items which are necessary for the current pane to fill up.Comment #7
esolitosThanks for the patch, I rerolled it and applied to the current 2.1 release! :)