Currently there's now clear definition how the array in $views->result has to be indexed.
This lead to some confusion:

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:

User interface changes


API changes

Yes, see Proposed resolution

#4 views-1368508-4.patch1.4 KBtim.plunkett
PASSED: [[SimpleTest]]: [MySQL] 1,458 pass(es).
[ View ]
views-document-enforce-numeric-keys-for-results-array.patch1.38 KBdas-peter
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch views-document-enforce-numeric-keys-for-results-array.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]


Issue summary:View changes

Updated issue summary.

Created patch for Search API views integration: #1368548: Do not index views results by entity id

I'm in favor of this.

Issue summary:View changes

Updated issue summary.

Status:Needs review» Reviewed & tested by the community

This looks fine from my perspective. I also support this idea as there might be some theming related code which already expects such a behavior.

new1.4 KB
PASSED: [[SimpleTest]]: [MySQL] 1,458 pass(es).
[ View ]

Rerolled around some docs changes.

I finally got round to responding in #1368548-6: Do not index views results by entity id. See there for commit planning discussion.

Status:Reviewed & tested by the community» Needs work
Issue tags:+Needs change record

Committed 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.

I 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.

Issue summary:View changes

Updated issue summary.