Improve View Modes with entity-reference relationships

Created on 22 November 2016, almost 8 years ago
Updated 11 June 2024, 4 months ago

Problem/Motivation

Make it possible to pull in fields from referenced entities in a display view mode.

Drupal is very strong in building data-structures with the entity_reference module.
Might it be possible to use these structures in view-modes?

Some examples of Drupal data-structures with relationships to other entities:
1. An article (type node):
- an author (type user)
- some tags (type taxonomy_term)
2. A page (type node):
- some paragraphs (type paragraph)
- an author (type user)
3. A product (type commerce_product):
- an author (type user)
- a store (type commerce_store)
- variations (type commerce_product_variation)

When creating a view-mode for those 3 things (article, page, product), currently you cannot 'drill down' to fields that are attached to the references entities (user, store, paragraph).

Currently a module like Display Suite leverages the 'extra_fields' hook. That hooks lacks lot's of functionality from 'real' fields (doesn't use field-formatter settings).
It also needs custom coding per-field.
It kinda works for a field like 'author name' (every site has it), but it won't work for any non-standard field.

Proposed resolution

Add an option a-like Views to add a "Relationship" to a Display view mode via the entity_reference fields.
When you do this, all fields from the referenced child-entity are then available like they are 'normal' fields that belong to the parent-entity.
It should include field-formatter settings per view-mode and also the relationship should be drillable (node->user->group->...).

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Closed: outdated

Component

Idea

Created by

🇳🇱Netherlands ndf Amsterdam

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇦🇺Australia pameeela

    We are trying to curate the ideas queue to get the number of open issues down to a manageable level. I'm going to close this issue since it's quite old and does not have any additional comments. It's a cool idea though and actually now it may be solved by layout builder? You can build a view using relationships and add it as a block to the layout.

Production build 0.71.5 2024