Uh oh!
There was an error while loading. Please reload this page.
[5.x] Move sites out of config - #9632
Conversation
# Conflicts: # tests/FrontendTest.php
robdekort
commented
Apr 10, 2024
I'm wondering if this should be in the CP nav under |
jasonvarga
commented
Apr 10, 2024
That's a good thought. |
With more complex site configurations, it is now much more difficult to achieve a reliable result with all these curly brackets as placeholders for URLs etc. - especially if you have also used PHP enums or collections/arrays in the "attributes". Code analysis and testing also now seem more difficult to achieve. Is there still a way e.g. to override this Thanks! |
duncanmcclean
commented
May 30, 2024
We're not planning on adding back a PHP method for configuring sites. However, in your case, you could potentially override the sites in a service provider, like this: // app/Providers/AppServiceProvider.phpuseStatamic\Facades\Site;
useStatamic\Statamic;
Statamic::booted(function () {
Site::setSites([
'default' => [
'name' => 'Default',
'locale' => 'en_US',
'url' => YourEnum::Url,
],
]);
}); |
ajnsn
commented
May 30, 2024
Thanks! |
What is changing...
The idea here is to move
sitesconfiguration out of the php config directory, and intocontent/sites.yaml, so that we can provide a nice GUI for managing your site/sites (since theconfigdirectory is meant to be edited by devs only)...If you need multi-site, you enable it in
config/statamic/system.php...We've also streamlined the
php please multisitecommand to do this for you...This allows you to manage multiple sites in the cp...
Of course, you can still manage your sites by hand as before, but now that'll be in
content/sites.yaml...TODO...
statamic.sites.sitesconfigstatamic.system.multisiteconfigSitesclasssetConfig()method, with deprecated backwards compatibility fallback for addonssetSites()andsetSiteValue()methodssave()methodsitesconfigdirectionfrom configconfig('statamic.sites.sites')to use new yaml sites configphp please multisitecommandmultisiteconfig into theirconfig/statamic/system.phpconfig/statamic/sites.phptocontent/sites.yamlconfig/statamic/sites.phpconfig, since it is no longer neededClosesstatamic/ideas#1080