Fixes #131 - Add event to ConfigMaker

This commit is contained in:
Sam Georges 2014-05-17 22:10:01 +10:00
parent 873c185352
commit 68bb4315cb
1 changed files with 14 additions and 1 deletions

View File

@ -1,12 +1,13 @@
<?php namespace System\Traits;
use stdClass;
use Str;
use File;
use Lang;
use Event;
use October\Rain\Support\Yaml;
use System\Classes\SystemException;
use Backend\Classes\Controller;
use stdClass;
/**
* Config Maker Trait
@ -48,6 +49,18 @@ trait ConfigMaker
throw new SystemException(Lang::get('system::lang.config.not_found', ['file' => $configFile, 'location' => get_called_class()]));
$config = Yaml::parse(File::get($configFile));
/*
* Extensibility
*/
$publicFile = File::localToPublic($configFile);
if ($results = Event::fire('system.extendConfigFile', [$publicFile, $config])) {
foreach ($results as $result) {
if (!is_array($result)) continue;
$config = array_merge($config, $result);
}
}
$config = $this->makeConfigFromArray($config);
foreach ($requiredConfig as $property) {