Skip to content

[6.x] Add fluent plugin configuration - #19574

Merged
brandonkelly merged 10 commits into
6.xfrom
cms-1003-fluent-plugin-configs
Sep 8, 2026
Merged

[6.x] Add fluent plugin configuration#19574
brandonkelly merged 10 commits into
6.xfrom
cms-1003-fluent-plugin-configs

Conversation

@riasvdv

@riasvdv riasvdv commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Description

Adds support for fluent plugin configuration by letting Plugins define methods on their PluginSettings class:

class MyPluginSettings extends PluginSettings
{
    public bool $enabled = false;

    public ?string $title = 'Default';
   
    public function title(?string $value): static
    {
        $this->title = $title;

        return $this;
    }

    public function enabled(bool $enabled = true): static
    {
        $this->enabled = $enabled;

         return $this;
    }
}

Which can then by used in the config file:

// config/craft/my-plugin.php

return MyPlugin::config()
    ->enabled()
    ->title('Some title');

Caution

This is a breaking change within the 6.x alpha. createSettingsModel() has been replace by a static createSettings() method which must now return an instance of PluginSettings and not just Validatable

@linear-code

linear-code Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

CMS-1003

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

📚 Storybook previews

@craftcms/uiopen Storybook

No changed components detected in this Storybook.

resources/jsopen Storybook

No changed components detected in this Storybook.

@riasvdv
riasvdv marked this pull request as ready for review September 7, 2026 12:21
@brandonkelly
brandonkelly merged commit 4205897 into 6.x Sep 8, 2026
@brandonkelly
brandonkelly deleted the cms-1003-fluent-plugin-configs branch September 8, 2026 18:31
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.

2 participants