Problem/Motivation
#2796173: Add experimental Field Layout module to allow entity view/form modes to switch between layouts allows for rearranging fields on entity form and entity view.
Entity forms use #group, which allows the array structure to remain unchanged, while rendering them into the regions.
That is only available to forms, not general render arrays.
Because of this, Entity view directly alters the array structure.
This increases the chances of contrib or custom code later trying to access the original location, resulting in broken functionality and possibly PHP notices.
Proposed resolution
The most straight-forward and robust solution would be to expand #group to work for all render arrays, which has an existing issue:
#2190333: Make #group FAPI / render feature work on all form/render #types out of the box
Should that prove too complex, consider trying something specific to entity rendering, or something on the preprocess level.
Or, this could be decided as something not worth fixing.
Remaining tasks
Decide what to do:
- Postpone on generic #group issue, #2190333: Make #group FAPI / render feature work on all form/render #types out of the box
- Develop new approach
- Close (won't fix)
User interface changes
N/A
API changes
TBD
Data model changes
N/A
Comments
Comment #4
anybodyYeah it's really a very very important issue to keep the array / field structure unchanged when using regions. +1 for this issue and plan.
We just ran exactly into this issue and discussion.
How can we help to proceed?
Comment #5
anybodyPerhaps a secondary feature might be to add an option "Disabled" to use the default node structure without layouts for view modes?
Comment #6
thomas.frobieterAny updates to this topic? The layout system is pracitcly useless because of this ...
Comment #7
tim.plunkettNo update that I know of.
Someone needs to do the work.
See the proposed resolution and remaining tasks above.
Comment #9
tim.plunkettComment #12
panchoThere's a working patch now in #2190333: Make #group FAPI / render feature work on all form/render #types out of the box, so we should postpone this one as suggested.
Comment #19
quietone commentedJust adding postponed issue to the remaining tasks.
Comment #22
quietone commentedThe Field Layout Module was approved for removal in #3007167: [policy] Deprecate field_layout module and move it to contrib.
This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.
The deprecation work is in #3517712: [meta] Tasks to deprecate the Field Layout module and the removal work in #3517716: [meta] Tasks to remove Field Layout module.
Field Layout will be moved to a contributed project after the Drupal 12.x branch is open.
Comment #24
andypostComment #25
quietone commented