Problem/Motivation

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

none.

API changes

Yes, see Proposed resolution

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

das-peter’s picture

Issue summary: View changes

Updated issue summary.

das-peter’s picture

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

merlinofchaos’s picture

I'm in favor of this.

merlinofchaos’s picture

Issue summary: View changes

Updated issue summary.

dawehner’s picture

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.

tim.plunkett’s picture

FileSize
1.4 KB

Rerolled around some docs changes.

drunken monkey’s picture

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

dawehner’s picture

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.

chx’s picture

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.

chx’s picture

Issue summary: View changes

Updated issue summary.