Skip to content

[6.x] Allow addon settings blueprints to be registered lazily - #15286

Merged
jasonvarga merged 1 commit into
6.xfrom
register-settings-blueprint
Aug 27, 2026
Merged

[6.x] Allow addon settings blueprints to be registered lazily#15286
jasonvarga merged 1 commit into
6.xfrom
register-settings-blueprint

Conversation

@jasonvarga

Copy link
Copy Markdown
Member

registerSettingsBlueprint only accepted an array, so any work needed to build the blueprint happened on every request, whether or not the settings screen was ever visited. An addon passing a container to an assets field might do AssetContainer::all()->first(), for instance.

It now accepts a closure too, evaluated only when the blueprint is needed:

$this->registerSettingsBlueprint(fn () => [
'tabs' => [...],
]);

Passing an array still works as before.

registerSettingsBlueprint now accepts a closure in addition to an array, so addons can defer expensive work until the blueprint is actually needed rather than on every request.
The binding is scoped so the closure is only evaluated once per request, and hasSettingsBlueprint no longer resolves the blueprint just to check whether one exists.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jasonvarga
jasonvarga enabled auto-merge (squash) August 27, 2026 00:49
@jasonvarga
jasonvarga merged commit d167065 into 6.xAug 27, 2026
65 checks passed
@jasonvarga
jasonvarga deleted the register-settings-blueprint branch August 27, 2026 00:51
Sign up for freeto 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

@jasonvarga