Respect hook_entity_form_display_alter() in field group

Created on 15 February 2024, 4 months ago

Problem/Motivation

The hook_entity_form_display_alter() allows to alter a form display after it has been loaded, and before it is applied.
The field_group_info_groups() does not respect these changes, and instead loads a fresh unaltered form display instance from config.

Steps to reproduce

Configure a form display with field groups.
Implement hook_entity_form_display_alter() to change the type or label of one of the field groups in third party settings.
Visit the form.

Expected: Alterations are applied.
Actual: Alterations are not applied.

Proposed resolution

Instead of loading a fresh form display object, pass the original object via $context['display'].

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Active

Version

3.0

Component

Miscellaneous

Created by

πŸ‡©πŸ‡ͺGermany donquixote

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

Comments & Activities

  • Issue created by @donquixote
  • πŸ‡©πŸ‡ͺGermany donquixote

    I wanted to give this a try, but I give up.
    There are too many places that call field_group_info_groups() which do not have the altered $display object available.
    Sad!
    It also makes me think that in core itself this hook is not very useful.

Production build 0.69.0 2024