Contrib modules can't alter the building of entity form displays

Created on 23 December 2015, about 9 years ago
Updated 12 January 2024, 12 months ago

Problem/Motivation

The field_attach_form hooks were removed in #2095195: Remove deprecated field_attach_form_*() β†’ , but by removing this, it also removed the possibility to alter entity forms.

An example:
There is currently an issue in field_group when paragraphs are added on the node form. #2637148: Field Group not working on node edit inside paragraph β†’
What is happening: Because of the lack of hooks, field_groups tried to add the grouping via a regular form_alter. This works perfect for node forms, but is causing issues when multiple entity forms are embed into 1 form (paragraphs, inline entity form, field_collection, ...). Field_group has no clue that multiple entity forms will be shown, and on what places this will be. (unless we loop recursive trough the whole form, but even then we probably have missing info).

Proposed resolution

Introduce an alter hook in EntityFormDisplay:buildForm. This will provide other modules the option to hook into the building of an entity form. Even when multiple entity forms are build into 1 form.

User interface changes

None

API changes

A new hook is introduced

✨ Feature request
Status

Closed: won't fix

Version

11.0 πŸ”₯

Component
FieldΒ  β†’

Last updated 2 days ago

Created by

πŸ‡§πŸ‡ͺBelgium nils.destoop

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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

    Per #34, since it's been a year without movement going to go ahead and close.

    If anyone disagrees please reopen expressing why though.

    Thanks!

  • πŸ‡¨πŸ‡¦Canada Liam Morland Ontario, CA πŸ‡¨πŸ‡¦

    The code still contains this comment:

    // @todo Remove as part of https://www.drupal.org/node/2640056
    

    If this won't be fixed, perhaps this comment should be removed.

Production build 0.71.5 2024