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
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 2801743-4--views_entity_field_rendering.patch | 3.1 KB | drunken monkey |
| #4 | 2801743-4--views_entity_field_rendering--tests_only.patch | 2.11 KB | drunken monkey |
Comments
Comment #2
ifrikComment #3
drunken monkeyI 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.
Comment #4
drunken monkeyJust noticed a problem similar to the one you're describing. Does the attached patch resolve the problem for you?
Comment #6
drunken monkeyI've now included this in #2650364: Add a "skip access checks" option to the Views relationship plugin.
Comment #7
mkolar commentedwe 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..
Comment #8
seanbI 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 » Acronymcontact_organisation_zipcode:
Contact » Node » Organisation » Taxonomy term » ZipcodeThe 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 isnull. Not sure how to fix this though.Comment #9
drunken monkeyPlease create a new issue for that.