[6.x] Fix addon settings not being found when the addon has a custom slug - #15495
Merged
Merged
Conversation
`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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request fixes an issue where addon settings appeared to be lost on reload when the addon sets a custom
slugin itscomposer.jsonthat 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), whileFileSettingsRepository::find()derived the filename from the package name. For a package likevendor/statamic-examplewith slugexample, a save wroteexample.yamland the next read looked forstatamic-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()andpath()agree. Since the addon is already in hand, the reverse slug lookup inmakeFromPath()is no longer needed and has been removed.Fixes #15494