mirror of
https://github.com/flextype/flextype.git
synced 2025-08-09 06:36:52 +02:00
Flextype: new method setSiteConfig() added
This commit is contained in:
@@ -62,15 +62,7 @@ class Flextype
|
||||
// Turn on output buffering
|
||||
ob_start();
|
||||
|
||||
// Set empty site item
|
||||
Registry::set('site', []);
|
||||
|
||||
// Set site items if site config exists
|
||||
if (Filesystem::fileExists($site_config = PATH['config'] . '/' . 'site.yaml')) {
|
||||
Registry::set('site', Yaml::parseFile($site_config));
|
||||
} else {
|
||||
throw new \RuntimeException("Flextype site config file does not exist.");
|
||||
}
|
||||
Flextype::setSiteConfig();
|
||||
|
||||
// Set internal encoding
|
||||
function_exists('mb_language') and mb_language('uni');
|
||||
@@ -127,6 +119,24 @@ class Flextype
|
||||
set_exception_handler('Flextype\Component\ErrorHandler\ErrorHandler::exception');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set site config
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected static function setSiteConfig() : void
|
||||
{
|
||||
// Set empty site item
|
||||
Registry::set('site', []);
|
||||
|
||||
// Set site items if site config exists
|
||||
if (Filesystem::fileExists($site_config = PATH['config'] . '/' . 'site.yaml')) {
|
||||
Registry::set('site', Yaml::parseFile($site_config));
|
||||
} else {
|
||||
throw new \RuntimeException("Flextype site config file does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Flextype instance.
|
||||
* Create it if it's not already created.
|
||||
|
Reference in New Issue
Block a user