/** * Initializes and run theme feature. */ public function run() { if (false == $this->settings || !isset($this->settings['options'])) { return; } $theme = null; $selected = $this->defineSelectedThemeName($this->app->getSite()); foreach (ThemeTool::getThemesFromOptions($this->settings['options']) as $name => $obj) { if ($name === $selected) { $theme = $obj; } } $this->initializeTheme($theme); }
/** * Returns the current site if defined. * * @param Site|null $site Optional, if provided, will be return. * * @return Site|null */ private function getCurrentSite(Site $site = null) { if (null !== $site) { return $site; } if (null !== $this->application) { return $this->application->getSite(); } return null; }
/** * @param Event $event */ public function onGetServiceConfig(Event $event) { if (true === $this->application->isStarted()) { $config = $event->getTarget(); if (null !== ($override_site = $config->getRawSection('override_site'))) { if (array_key_exists($this->application->getSite()->getUid(), $override_site)) { foreach ($override_site[$this->application->getSite()->getUid()] as $section => $data) { $config->setSection($section, $data, true); } } } $this->application->getContainer()->getDefinition($event->getArgument('id'))->clearTag('config_per_site'); } }