Consider adding support for 'field aliases' in EVD (allow an EVD to render a field several times)

Created on 5 May 2015, about 10 years ago
Updated 11 May 2025, 1 day ago

After #1867518: Leverage entityDisplay to provide fast rendering for fields β†’ , per-field Views use EntityViewDisplay objects to render their fields.

Since Views allows the same field to appear several times with different formatter settings, it still has code to split those "extra occurrences" to separate overfolw EVDs.

It could be interesting to let component explicitly specify the field they are about :
I.e :

component_name : 
  field: field_foo
  type: some_formatter
  settings : [some settings]

When rendering that component, the field that gets rendered is 'field_foo', and the output is placed in $builld['component_name'] in the render array. I.e. we decouple "the name of the field" from "the name of the resulting render array key", thus allowing the same field to appear more than once.

For now, the "manage display" UI would still only generate "at most one component per field, component name == field name", as currently, but that ability can be leveraged by runtime EVDs like the ones used by Views.

Not sure how we'd want to treat the existing EVDs exported in config though :
- if 'field' is absent, consider 'field' = the component name (allows BC with existing EVDs)
- consider 'field' required (cleaner, lets us more clenaly differentiate between "field components" and "extra field components", but requires a beta2beta update of existing EVDs)

πŸ“Œ Task
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

entity system

Created by

πŸ‡«πŸ‡·France yched

Live updates comments and jobs are added and updated live.
  • VDC

    Related to the Views in Drupal Core initiative.

  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

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.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

  • πŸ‡·πŸ‡΄Romania amateescu

    I think this is still worth doing.

Production build 0.71.5 2024