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)