Get theme config from yaml file

@param string $theme
@return array
969712
public function getThemeConfig($theme)
	{
		Yii::import('mustangostang.spyc.Spyc');
		define('DS', DIRECTORY_SEPARATOR);

		$themeName = $this->urlTitle($theme);
		$configPath = Yii::getPathOfAlias('webroot.themes.'.$theme).DS.$themeName.'.yaml';

		if(file_exists($configPath))
			return Spyc::YAMLLoad($configPath);
		else
			return null;
	}
30520
public function setTheme(Theme $theme = null)
    {
        $theme_path = null;
        if ($theme) $theme_path = THEME_DIR.'/'.$theme->name;
        self::getDbConnection()->update('dir_data',array('templateDir'=>$theme_path),array('id'=>$this->id));
		$this->updateCache();
		return $this;
    }
1309739
public function find($themeName)
    {
        // Search for registered themes
        foreach ($this->themes as $theme) {
            if ($theme->name == $themeName) {
                return $theme;
            }

        }

        throw new Exceptions\themeNotFound($themeName);
    }
1042317
protected function getThemeConfigurationFiles(Container $app)
    {
        $files = [];
        $config_path = $app->make('config')->get('theme.config_path', realpath($app->make('wp.theme')->getRoot()) . '/config');
        
        if (file_exists($config_path) && is_dir($config_path)) {
            foreach (Finder::create()->files()->name('*.php')->in($config_path) as $file) {
                $nesting = $this->getThemeConfigurationNesting($file, $config_path);
                
                $files[$nesting . basename($file->getRealPath(), '.php')] = $file->getRealPath();
            }
        }
        
        return $files;
    }
734519
protected function getConfigByTheme(array $config, $themeId = null)
    {
        if (null === $themeId) {
            $themeService = $this->getServiceLocator()->get(ThemeService::SERVICE_ID);
            $themeId = $themeService->getCurrentThemeId();
        }
        if (is_array(reset($config))) {
            if (array_key_exists($themeId, $config)) {
                $config = $config[$themeId];
            } else {
                $config = array_shift($config);
            }
        }
        return $config;
    }
663195
public function serialize(Theme $theme)
    {
        return [
            'id' => $theme->getUuid(),
            'name' => $theme->getName(),
            'normalizedName' => str_replace(' ', '-', strtolower($theme->getName())),
            'current' => $theme->getNormalizedName() === str_replace(' ', '-', strtolower($this->config->getParameter('theme'))),
            'meta' => [
                'description' => $theme->getDescription(),
                'default' => $theme->isDefault(),
                'enabled' => $theme->isEnabled(),
                'custom' => $theme->isCustom(),
                'plugin' => $theme->getPlugin() ? $theme->getPlugin()->getShortName() : null,
                'creator' => $theme->getUser() ? $this->userSerializer->serialize($theme->getUser()) : null,
            ],
            'parameters' => [
                'extendDefault' => $theme->isExtendingDefault(),
            ],
        ];
    }
314380
private function loadTemplates(array $themes)
    {
        $templates = array();
        foreach ($themes as $theme) {
            $key = is_object($theme) ? spl_object_hash($theme) : $theme;

            if (!isset($this->templates[$key])) {
                $template = $this->twig->load($theme);

                $this->templates[$key] = $template;
            }

            $templates[] = $this->templates[$key];
        }

        return $templates;
    }
198288
public function symlink($theme)
    {
        $trace = debug_backtrace();

        if (! isset($trace[1])) return;

        $link = str_replace($this->getThemeName(), $theme, array_get($trace[1], 'file'));

        extract($this->arguments);
        extract($this->view->getShared());

        return require($link);
    }
1274679
public function findConfigFile(string $path) : array
    {
        $configFilePath = rtrim($path, '/') . '/' . TranslationServer::CONFIG_FILE_NAME;
        if (!is_file($configFilePath)) {
            throw new Exception('File ".translation.yml" not found');
        }

        $yamlParser = new YamlParser();
        $config = $yamlParser->parse(file_get_contents($configFilePath));

        return $config;
    }
1265335
private function updateConfigDetails($theme, $lines, $config)
    {
        $inColors     = false;
        $filledColors = false;

        foreach ($lines as $key => $line) {
            if (strpos($line, "'theme' =>") !== false) {
                $lines[$key] = "\t'theme' => '$theme',";
                continue;
            }
            if (strpos($line, "'colors'") !== false) {
                $inColors = true;
                continue;
            }

            if ($inColors == true && $filledColors == false) {
                list($lines, $filledColors) = $this->replaceColors($config, $lines, $key);
                continue;
            } elseif ($inColors == true) {
                if (strpos($line, ']') !== false) {
                    $inColors = false;
                    continue;
                }
                unset($lines[$key]);
            }
        }

        return $lines;
    }
521581
public function theme($theme = null)
    {
        // If theme name is not set, so use default from config.
        if ($theme != false) {
            $this->theme = $theme;
        }

        // Is theme ready?
        if (! $this->exists($theme)) {
            throw new UnknownThemeException("Theme [$theme] not found.");
        }

        // Add location to look up view.
        $this->addPathLocation($this->path());

        // Fire event before set up a theme.
        $this->fire('before', $this);

        // Before from a public theme config.
        $this->fire('appendBefore', $this);

        // Add asset path to asset container.
        $this->asset->addPath($this->path().'/'.$this->getConfig('containerDir.asset'));

        return $this;
    }
110007
public function getResourcePath(string $resource, Theme $theme = null) : string
    {
        return $this->createPath($this->getBasePath($theme), $resource);
    }
1183942
protected function readConfig($path)
    {
        if (!file_exists($path) || !is_file($path) || !is_readable($path)) {
            return array();
        }

        $yaml = new Parser();

        try {
            $config = (array) $yaml->parse(file_get_contents($path));
        } catch (ParseException $e) {
            return array();
        }

        // adjust relative paths
        foreach ($this->paths as $key) {
            if (isset($config[$key])) {
                $config[$key] = $this->normalizePath($config[$key]);
            }
        }

        return $config;
    }
1216106
protected function loadViewsFromTheme(Theme $theme)
    {
        $views = $theme->getViewDirectory();

        $this->loadViewsFrom($views, $theme->getName());
        $this->loadViewsFrom($views.'/boomcms', 'boomcms');
        $this->loadViewsFrom($views.'/chunks', 'boomcms.chunks');
    }
225987
public function path($file, $theme = null)
    {
        if (is_null($theme)) {
            $theme = $this->getCurrent();
        }

        return $this->config['paths']['base']."/$theme/$file";
    }
1074043
protected function set_theme($theme = null, $type = 'active')
	{
		// set the theme if given
		if ($theme !== null)
		{
			// remove the defined theme asset paths from the asset instance
			empty($this->active['asset_path']) or $this->asset->remove_path($this->active['asset_path']);
			empty($this->fallback['asset_path']) or $this->asset->remove_path($this->fallback['asset_path']);

			$this->{$type} = $this->create_theme_array($theme);

			// add the asset paths to the asset instance
			empty($this->fallback['asset_path']) or $this->asset->add_path($this->fallback['asset_path']);
			empty($this->active['asset_path']) or $this->asset->add_path($this->active['asset_path']);
		}

		// and return the theme config
		return $this->{$type};
	}
62859
public function hasTheme($theme)
    {
        if (is_dir($this->getThemesDir() . $theme)) {
            return true;
        } else {
            foreach (modules() as $module) {
                if (in_array($module->getType(), ['KERNEL', 'FRAMEWORK'])) {
                    continue;
                } elseif (is_dir($module->getResourcesDir('themes') . $theme)) {
                    return true;
                }
            }
        }

        return false;
    }