Problem/Motivation
Currently there's now clear definition how the array in $views->result
has to be indexed.
This lead to some confusion:
- Will become superfluous: #1350814: EntityFieldHandlerHelper should not use views row_index as entity_id
- #1351524: SearchApiViewsQuery::get_result_wrappers(): Do not use views row_index as entity_id.
Especially because there's views_content_plugin_style_ctools_context (see line 31-34) which enforces numeric keys starting at 0.
Proposed resolution
Enforce numeric array keys starting at 0 for $views->result
.
Document the requirement for $views->result
and enforce the standard in view::execute()
.
Update affected code to be compatible. Known projects:
- Entity API
- Search-API
Remaining tasks
Review patch and ensure the depending projects are ready for the change.
Related tickets:
- Will become superfluous: #1350814: EntityFieldHandlerHelper should not use views row_index as entity_id
- #1368548: Do not index views results by entity id
User interface changes
none.
API changes
Yes, see Proposed resolution
Comment | File | Size | Author |
---|---|---|---|
#4 | views-1368508-4.patch | 1.4 KB | tim.plunkett |
views-document-enforce-numeric-keys-for-results-array.patch | 1.38 KB | das-peter | |
Comments
Comment #0.0
das-peter CreditAttribution: das-peter commentedUpdated issue summary.
Comment #1
das-peter CreditAttribution: das-peter commentedCreated patch for Search API views integration: #1368548: Do not index views results by entity id
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedI'm in favor of this.
Comment #2.0
merlinofchaos CreditAttribution: merlinofchaos commentedUpdated issue summary.
Comment #3
dawehnerThis looks fine from my perspective. I also support this idea as there might be some theming related code which already expects such a behavior.
Comment #4
tim.plunkettRerolled around some docs changes.
Comment #5
drunken monkeyI finally got round to responding in #1368548-6: Do not index views results by entity id. See there for commit planning discussion.
Comment #6
dawehnerCommitted to both 7.x-3.x and 8.x-3.x
Thanks for the work, this is a step towards a 7.x-3.4 release.
This might require some chance notification.
Comment #7
chx CreditAttribution: chx commentedI would love to sync an efq_views with a Views release after this -- Jorrit fixed efq_views in #1704612: EFQ efq_views_plugin_query::query() should return numeric array and I fixed my tests so we are ready.
Comment #7.0
chx CreditAttribution: chx commentedUpdated issue summary.