Problem/Motivation

When fields of nested entities are indexed and displayed in a view with "Use entity field rendering" enabled, the only the first entity is loaded, and no values or wrong value are displayed. Disabling this per field, displays the correct values.

How to reproduce this:
Create an entity reference from one entity to another, and index it with fields from both entities. For example the title of a node, and the name and email address of its author.
Make a view to display the indexed results, using fields as display mode and add these fields, leaving "Use entity field rendering" enabled.
Check the results in the preview: Some fields will be blank.
Re-order the fields, and others will be blank.
If two fields have the same label, the value displayed for both of them is the same, but changes if the order is changed.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

ifrik created an issue. See original summary.

ifrik’s picture

Title: Wrong entity load with for entity field rendering » Wrong entity loaded for "entity field rendering"
drunken monkey’s picture

Status: Active » Postponed (maintainer needs more info)

I can't reproduce this with the steps you list.
Are you using the latest version of Drupal Core, and of this module?
Which fields, exactly, are you adding, and configured how? (Maybe attach an export of both your search index and your view (provided they only use entities and fields from the standard profile).)

Or does this maybe happen with a multi-valued reference instead of the single-valued example (author) you cite?
For multi-valued references, depending on the exact structure, this might be a known problem. But please cite a working example for that, and we can try and work from there.

drunken monkey’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new2.11 KB
new3.1 KB

Just noticed a problem similar to the one you're describing. Does the attached patch resolve the problem for you?

The last submitted patch, 4: 2801743-4--views_entity_field_rendering--tests_only.patch, failed testing.

drunken monkey’s picture

mkolar’s picture

we have same or similar problem... We have index with field relation to author uid, and its fields (last_name for example), than we have relation to another user in different field and also its fields (last_name). Than we have view and with two fields last_name from both relations.. if I use "Use entity field rendering" in second relation field last_name I can see data of first relation in that column.. unchecking "Use entity field rendering" fixes the problem..

seanb’s picture

Status: Closed (outdated) » Needs work

I can confirm this is still an issue. I have 2 nested fields added (using Solr by the way) and want to "Use entity field rendering".
contact_organisation_category_acronym: Contact » Node » Organisation » Taxonomy term » Category » Taxonomy term » Acronym
contact_organisation_zipcode: Contact » Node » Organisation » Taxonomy term » Zipcode

The entity field renderer can only render the first field. Somehow the buildFields() method only returns values for the first one it finds. The relationship for both fields is null. Not sure how to fix this though.

drunken monkey’s picture

Status: Needs work » Closed (outdated)

Please create a new issue for that.