Closed (fixed)
Project:
Entity Reference View Widget
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Oct 2011 at 16:49 UTC
Updated:
28 Oct 2011 at 23:30 UTC
foreach ($view->result as $key => $result) {
$entity_id = reset($result);
// ...
}
This is not an assumption we can do. Let's look at alternatives.
Comments
Comment #1
das-peter commentedWhat about using this:
Comment #2
jbova commentedGreat job on this project. In my case, the node published date was the first column in my view, meaning the substitutions did not work.
The solution proposed by das-peter was applied and tested successfully.
Comment #3
bojanz commentedWe should just use $view->query->get_result_entities();
It's nice and consistent, and will allow us to use Search API views as well, as soon as they fix #1308928: SearchApiViewsQuery should implement get_result_entities().
Committed: http://drupalcode.org/project/entityreference_view_widget.git/commitdiff...
Comment #4
fangel commentedAlso, in the latest Views 7.x-dev (as of today, Oct. 14)
get_result_entitiesis returning the entities keyed by row-id, not entity-id (as indicated by this comment "Re-key the array by row-index.". Soentity_extract_idsshould really be used instead to find the entity-id.I changed
entityreference_view_widget_field_widget_formto use the following insteadComment #5
bojanz commentedI suck :/ Committed a followup.