1
0
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:
Awilum
2018-06-02 22:28:34 +03:00
parent 09c5f637a9
commit 3285b7515c

View File

@@ -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.