feat: extensible section form schema via extendSchemaUsing [3.x]#165
Merged
Conversation
Add SectionForm::extendSchemaUsing() so applications can append fields to the section management form from a service provider, without subclassing or vendor patching. One registration covers both the Add and Edit section modals; the callback receives the current schema and the section entity type. flushSchemaExtensions() resets registrations (used in tests). Give CustomFieldSectionSettingsData a free-form extra array so consumer flags bound under settings.extra.* round-trip through the typed DTO (and through CustomFieldSectionData import/export). Enables flagging a section to render as its own tab.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an extension point to the Custom Fields section management form.
SectionForm::extendSchemaUsing(Closure $callback)— register a callback (e.g. from a service provider) that appends to / modifies the section form schema. A single registration covers both the Add and Edit section modals. The callback receives(array $schema, string $entityType), so extensions can be scoped per entity.SectionForm::flushSchemaExtensions()— clears registrations (test isolation).CustomFieldSectionSettingsDatagains a free-formarray $extrabag, so arbitrary consumer-defined settings bound undersettings.extra.*round-trip through the typed DTO (and throughCustomFieldSectionDataimport/export). The typed DTO silently drops unknown keys, so a bag is required for arbitrary flags to survive hydration.Why
Applications consuming
CustomFields::infolist()need to attach their own per-section metadata — e.g. "render this section as its own tab" — without subclassing the form or patching the vendor.Usage
Test plan
New tests in
CustomFieldsSectionManagementTest:extendSchemaUsingpersists intosettings.extraon createextravalue survives an edit round-tripVerified locally: full suite 694 passed; Pint, PHPStan, Rector
--dry-run, and arch tests all green. (Type coverage sits at 99.4% on3.xalready — pre-existing, in unrelated files.)Notes
[]; the hook is opt-in.settingsis already JSON.