Skip to content

[5.x] Add config extra sections with fields to existing fieldtypes #11712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: 5.x
Choose a base branch
from

Conversation

nopticon
Copy link
Contributor

After reading https://statamic.dev/extending/fieldtypes#adding-configuration-fields-to-existing-fieldtypes I noticed that extra sections are not added to fieldtype config.

use Statamic\Fieldtypes\Text;

Text::appendConfigFields([
    [
        'display' => __('Extra section'),
        'fields' => [
            'more_options' => [
                'display' => __('Options'),
                'instructions' => __('Instructions for this field'),
                'type' => 'array',
            ],
        ],
    ],
]);

Before this fix, it shows like this:

image

After fixing this issue, it shows fields inside the new section:

image

After adding appendConfigFields to a ServiceProvider, it can be tested on any blueprint at /cp/collections/{collection}/blueprints/{blueprint}/edit

This PR adds extra sections support to #5077 and #7706

Be able to create extra sections instead of just single fields.
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