I'd like to be able to alter a form normally, adding a regular form API field. Then for field_group to merge my form fields into field groups. Unfortunately field_group kills field names by defining a new variable instead of working with what exists. All so I can avoid having to use hook_field_group_build_pre_render_alter.

This is the desirable execution:

// Add new form API field in here.
my_module_form_alter();
// Field group currently adds a prerenderer (field_group_form_pre_render)
field_group_form_alter();
// Nesting creates the field group (via field_group_form_pre_render() -> field_group_build_entity_groups() -> field_group_fields_nest() )
// It should check if the group container already exists, uses a reference to it instead of re-instantiating.
field_group_fields_nest();

This makes it a lot easier to add custom form elements beneath a field group.

CommentFileSizeAuthor
#2 2921758-merge.patch602 bytesdpi

Comments

dpi created an issue. See original summary.

dpi’s picture

Status: Active » Needs review
StatusFileSize
new602 bytes

Adding patch.

jibran’s picture

Status: Needs review » Reviewed & tested by the community

Patch looks good to me.

  • zuuperman committed 6da073b on 8.x-3.x authored by dpi
    Issue #2921758 by dpi: Allow modules to define form elements beneath...
nils.destoop’s picture

Status: Reviewed & tested by the community » Fixed

Thx for the patch, I committed it to dev

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.