Skip to content

[6.x] Let appended config fields be placed after an existing config field - #16008

Open
marcorieser wants to merge 2 commits into
statamic:6.xfrom
marcorieser:config-field-placement
Open

marcorieser wants to merge 2 commits into
statamic:6.xfrom
marcorieser:config-field-placement

Conversation

@marcorieser

Copy link
Copy Markdown
Contributor

appendConfigField() always puts the field at the end of the field settings, in a new section when the fieldtype has more than one. An addon that extends a core fieldtype can't put its setting next to the one it belongs with.

I ran into this adding a "Conditional Defaults" setting that belongs right after "Default Value".

This adds an optional after argument:

Text::appendConfigField('conditional_defaults', [...], after: 'default');

The field is inserted right after the named one, in whichever section that is. If there is no such field, it is appended as before.

Includes tests for sectioned and linear fieldtypes, and for the fallback.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant