-
-
Notifications
You must be signed in to change notification settings - Fork 560
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
[6.x] Separate globals config and content #11585
Merged
Merged
Conversation
This file contains 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
This makes variables work the same way in single-sites as they do on multi-sites.
It's kinda unrelated to this PR, but it needs fixing so...
We don't want to rely on the existence of global variables anymore, in case they don't exist. The sites and their origins are now stored in the global set config.
We needed a way to pass in the sites array, rather than doing it afterwards.
$globalSet->save() will create the variables file for us, so we don't need this anymore.
… to pass data and call make doesn't really do anything.
…es havent worked for a long time anyway
they dont need to be saved since absence of a sites array will assume the default site is selected. we just want to move the files
jasonvarga
approved these changes
Mar 24, 2025
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.
#8343 aimed to split up global sets and global repositories into separate repositories, to bring it inline with other features where config and content is separate (eg. forms and form submissions).
However, even after it was merged, there were still a few places where they weren't totally separate, like they should be.
This PR aims to resolve these issues, as well as making various improvements to how globals work under the hood.
Changes:
UpdateGlobalVariables
update script will migrate global variables to the new format when updating.sites
array in the global set's config file, rather than being determined by the existence of global variables in sites.GlobalSet::in()
now returns aVariables
instance, even when the site doesn't have any variables.GlobalSet::addLocalization()
/GlobalSet::removeLocalization()
methods have been removed, in favour of calling->save()
and->delete()
on theVariables
object.GlobalSetCreated
/GlobalSetSaved
events to be dispatched.GlobalVariablesCreated
/GlobalVariablesSaved
.GlobalVariableSaved
event #10888Docs: statamic/docs#1643
Eloquent Driver PR: statamic/eloquent-driver#411