Repository navigation
[6.x] Expose expanded sections on tabs - #15694
Merged
Merged
Conversation
Tab::expandedSections() is now public and returns Section objects instead of publish arrays, so code other than the CP publish form can use fieldset section expansion. Sections can now hold pre-resolved fields, which imported fieldset sections use so their fields keep prefixes and config overrides. Publish output is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
This PR makes
Tab::expandedSections()public so code other than the CP publish form can use fieldset section expansion (added in #14297). It's a refactor; publish output is unchanged.Previously the expansion lived in private methods that returned publish arrays, so only
Tab::toPublishArray()could use it. Everything else calls$tab->sections(), which doesn't split sections around sectioned fieldset imports.Changes
Tab::expandedSections()is now public and returns aCollectionofSectionobjects.Tab::toPublishArray()maps them to publish arrays.Sectionaccepts an optional second constructor argument of already-resolvedFields, whichfields()returns when set. Imported fieldset sections use this, so their fields keep the import's prefixes and config overrides.Sectionhas resolved fields,toPublishArray()maps them directly instead of going throughFields::toPublishArray(). That method's Blink key ignores field prefixes, so fields that differ only by prefix could otherwise share cached output. The old code avoided it the same way.Tab::sections()andTab::fields()are unchanged.Backwards compatibility
Tab::toPublishArray()output before and after with one large fixture, and it's identical. The fixture covered nested imports with inner and outer prefixes, config overrides on prefixed imports, collapsible/collapsed sections, empty sections,section_behavior: flatten, and multiple imports of the same fieldset.expandedSections()going from private to public would only clash with an addon subclass ofTabthat declares its ownexpandedSections().collapsible/collapsedvalue (e.g. a quoted'yes'), it now ends up as a boolean in the publish array, the same as blueprint sections already do. YAML booleans are unaffected.Why
The forms-2 work (the forms API and
form:create) will useexpandedSections()so forms show fieldset sections the same way the CP does.Possible follow-ups
These still flatten sectioned imports via
$tab->sections()on 6.x. Switching them toexpandedSections()would be a behaviour change, so they're left alone here:Forms\Tags(form:createsections)Auth\UserTags(user register/profile forms)