/** * @param GetResponseEvent $event */ public function onKernelRequest(GetResponseEvent $event) { $channel = $this->context->getChannel(); if (!$channel instanceof ChannelInterface) { return; } $theme = 'default'; if ($configs = $this->resolver->getConfigs($channel)) { foreach ($configs as $config) { if ($config->getAdapter() === WebsiteManifest::NAME) { $theme = $config->getOptions()->get('theme'); break; } } } $this->themeManager->setActiveTheme($theme); }
/** * @param string $theme * * @return array */ public function getLayouts($theme) { if (null === $this->layouts) { $this->layouts = []; foreach ($this->themeManager->getThemes() as $id => $theme2) { if ($theme === $id) { foreach ($theme2->getPaths() as $resource) { $path = $this->themeManager->locateResource($resource); if (is_dir($path)) { $finder = new Finder(); $finder->files()->in($path)->depth(0)->name('*.html.twig'); /** @var \Symfony\Component\Finder\SplFileInfo $file */ foreach ($finder as $file) { $this->layouts[] = $resource . '/' . $file->getRelativePathname(); } } } } } } return $this->layouts; }
/** * @param Company $company * @return \Symfony\Component\HttpFoundation\Response */ public function showAction(Company $company) { $this->blockManager->setDocument($company); return $this->templating->renderResponse($this->themeManager->locateTemplate('content/Company/default.html.twig'), ['company' => $company]); }
/** * @return array */ protected function getChoices() { $themes = array_keys($this->themeManager->getThemes()); return array_combine($themes, $themes); }
/** * @param Taxonomy $taxonomy * @return \Symfony\Component\HttpFoundation\Response */ public function showAction(Taxonomy $taxonomy) { $this->blockManager->setDocument($taxonomy); return $this->templating->renderResponse($this->themeManager->locateTemplate('content/Taxonomy/default.html.twig'), ['taxonomy' => $taxonomy]); }
/** * {@inheritdoc} */ public function getGlobals() { return ['_theme' => $this->themeManager->getActiveTheme()]; }
/** * @param Event $event * @return \Symfony\Component\HttpFoundation\Response */ public function showAction(Event $event) { $this->blockManager->setDocument($event); return $this->templating->renderResponse($this->themeManager->locateTemplate('content/Event/default.html.twig'), ['event' => $event]); }
/** * @param Article $article * @return \Symfony\Component\HttpFoundation\Response */ public function showAction(Article $article) { $this->blockManager->setDocument($article); return $this->templating->renderResponse($this->themeManager->locateTemplate('content/Article/default.html.twig'), ['article' => $article]); }
/** * @param JobPosting $jobPosting * @return \Symfony\Component\HttpFoundation\Response */ public function showAction(JobPosting $jobPosting) { $this->blockManager->setDocument($jobPosting); return $this->templating->renderResponse($this->themeManager->locateTemplate('content/JobPosting/default.html.twig'), ['jobPosting' => $jobPosting]); }