private function loadThemeConfig(Config $config, $theme, $childTheme)
{
$themePath = $this->app['resources']->getPath('themebase') . '/' . $theme;
if (file_exists($themePath)) {
$configFile = $themePath . '/config.yml';
// insert parent path right after child path.
$twigPath = $config->get('twigpath');
if ($twigPath) {
$childThemePath = $this->app['resources']->getPath('themebase') . '/' . $childTheme;
$key = array_search($childThemePath, $twigPath);
if ($key !== false) {
array_splice($twigPath, $key, 1, array($childThemePath, $themePath));
}
$config->set('twigpath', $twigPath);
}
if (file_exists($configFile)) {
$themeConfig = self::mergeConfigFile($configFile);
if ($themeConfig) {
// load parent theme config, but without overwriting, because child prevails
$config->set('theme', Arr::mergeRecursiveDistinct($themeConfig, $config->get('theme')));
// multiple levels allowed
if (!empty($themeConfig['parent'])) {
$this->loadThemeConfig($config, $themeConfig['parent'], $theme);
}
}
}
}
}