Skip to content

[6.x] Fix addon settings not being found when the addon has a custom slug - #15495

Merged
jasonvarga merged 1 commit into
6.xfrom
addon-settings-slug
Sep 21, 2026
Merged

jasonvarga merged 1 commit into
6.xfrom
addon-settings-slug

Conversation

@duncanmcclean

@duncanmcclean duncanmcclean commented Sep 21, 2026

Copy link
Copy Markdown
Member

This pull request fixes an issue where addon settings appeared to be lost on reload when the addon sets a custom slug in its composer.json that differs from the second half of its package name.

This was happening because FileSettings::path() writes the settings file under the addon's slug (resources/addons/<slug>.yaml), while FileSettingsRepository::find() derived the filename from the package name. For a package like vendor/statamic-example with slug example, a save wrote example.yaml and the next read looked for statamic-example.yaml, which never existed.

This PR fixes it by resolving the addon by its ID first and using its slug to build the path, so find() and path() agree. Since the addon is already in hand, the reverse slug lookup in makeFromPath() is no longer needed and has been removed.

Fixes #15494

`FileSettingsRepository::find()` derived the filename from the package name, while `FileSettings::path()` writes it under the addon's slug. Addons with a custom slug saved to one file and read from another.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
bpmore added a commit to bpmore/statamic-wrapped that referenced this pull request Sep 21, 2026
…mic/cms#15495

Statamic's fix for #15494 makes FileSettingsRepository::find() resolve
the addon with Addon::get(), which takes a package name. The addon's
readers were asking by slug, which the fixed core returns null for; the
look, the soundtracks and the share toggle would have fallen back to the
config file on the next Statamic release, with nothing in the log.

Found by applying PR 15495 to vendor and running the suite. A new test
holds SavedSettings::ADDON to the addon's id and both readers to the
same record; it fails with the old constant under the patched core.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jasonvarga
jasonvarga merged commit 7400bf7 into 6.x Sep 21, 2026
66 checks passed
@jasonvarga
jasonvarga deleted the addon-settings-slug branch September 21, 2026 19:53
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.

Addon settings are saved under the addon's slug but read back under its package name

2 participants