Skip to content

[6.x] Append configs before and after - #15067

Merged
jasonvarga merged 8 commits into
6.xfrom
append-configs-before-and-after
Oct 9, 2026
Merged

jasonvarga merged 8 commits into
6.xfrom
append-configs-before-and-after

Conversation

@jackmcdade

@jackmcdade jackmcdade commented Jul 23, 2026 •

Copy link
Copy Markdown
Member

This allows us to do this, and append Automagic Forms settings as the second section:

private function bootAutomagicForms(): void
{
    Form::appendConfigFields(
        handles: '*',
        display: 'Automagic Forms',
        fields: [
          // ...
        ],
        afterSection: 'name'
    );
}
  • beforeSection / afterSection take a section handle (name, fields, submissions, email). Only one may be passed.
  • Positions only apply when a new section is created. If display matches an existing section, the fields are merged into it, and passing a position throws an InvalidArgumentException.
  • If the target section doesn't exist (e.g. a typo, or an addon section registered later), the section is appended at the end and a warning is logged.
  • If a positioned section's handle collides with an existing section, it replaces that section in place (as unpositioned registrations already do) and a warning is logged that the position was ignored.
  • Positions aren't included in Form::extraConfigFor() (which also feeds form_config in the form tag and emails). They're available via Form::extraConfigPositionsFor().

@jackmcdade jackmcdade changed the title Append configs before and after [6.x] Append configs before and after Jul 23, 2026
@jackmcdade
jackmcdade changed the base branch from 6.x to forms-2 July 23, 2026 15:00
@duncanmcclean
duncanmcclean self-requested a review July 23, 2026 15:02
jackmcdade and others added 8 commits October 9, 2026 14:19
Positioning fields within a matched section is dropped, so the arguments always refer to section handles. Passing a position while adding fields to an existing section now throws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without a position, an existing section with the same handle wins. Positioned sections now behave the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
extraConfigFor also feeds the form tag's and emails' form_config, which shouldn't see CP layout hints. Positions are now available separately via extraConfigPositionsFor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Matches 6.x, where a section whose handle collides with an existing one replaces it. A positioned section that collides now also replaces in place, and logs that its position was ignored, so adding a position never changes the outcome.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Positions were filtered before same-display registrations collapsed, so a discarded registration's position could move, or throw for, the one that won.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Access section only exists on forms-2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jasonvarga
jasonvarga changed the base branch from forms-2 to 6.x October 9, 2026 18:21
@jasonvarga
jasonvarga force-pushed the append-configs-before-and-after branch from 75d61ba to 4178518 Compare October 9, 2026 18:28
@jasonvarga
jasonvarga merged commit ba4365d into 6.x Oct 9, 2026
64 checks passed
@jasonvarga
jasonvarga deleted the append-configs-before-and-after branch October 9, 2026 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants