コード例 #1
0
 private function getOptions($templatesFolder)
 {
     $kernel = $this->container->get('kernel');
     $deployBundle = $this->container->getParameter('red_kite_labs_theme_engine.deploy_bundle');
     $deployBundleAsset = new Asset($kernel, $deployBundle, $this->container->getParameter('red_kite_labs_theme_engine.web_path'));
     $deployBundlePath = $deployBundleAsset->getRealPath();
     $viewsDir = $deployBundlePath . '/Resources/views';
     return array("deployBundle" => $deployBundle, "configDir" => $deployBundlePath . '/' . $this->container->getParameter('red_kite_cms.deploy_bundle.config_dir'), "assetsDir" => $deployBundlePath . '/' . $this->container->getParameter('red_kite_cms.deploy_bundle.assets_base_dir'), "viewsDir" => $viewsDir, "templatesDir" => $templatesFolder, "deployDir" => $viewsDir . '/' . $templatesFolder, "uploadAssetsFullPath" => $this->container->getParameter('red_kite_cms.upload_assets_full_path'), "uploadAssetsAbsolutePath" => AssetsPath::getAbsoluteUploadFolder($this->container), "deployBundleAssetsPath" => "/" . $deployBundleAsset->getAbsolutePath(), "deployController" => $this->container->getParameter('red_kite_cms.deploy_bundle.controller'), "webFolderPath" => $this->container->getParameter('red_kite_cms.web_folder_full_path'), "websiteUrl" => $this->container->getParameter('red_kite_cms.website_url'), "credits" => $this->container->getParameter('red_kite_cms.love'), "kernelDir" => $kernel->getRootDir());
 }
コード例 #2
0
 private function locate($asset)
 {
     $asset = new Asset($this->kernel, $asset);
     $assetPath = $asset->getRealPath();
     return $assetPath;
 }
コード例 #3
0
 protected function findTemplate(PageTree $pageTree)
 {
     $templateTwig = 'RedKiteCmsBundle:Cms:Welcome/welcome.html.twig';
     if (null !== ($template = $pageTree->getTemplate())) {
         $themeName = $template->getThemeName();
         $templateName = $template->getTemplateName();
         $asset = new Asset($this->kernel, $themeName);
         $themeFolder = $asset->getRealPath();
         if (false === $themeFolder || !is_file($themeFolder . '/Resources/views/Theme/' . $templateName . '.html.twig')) {
             $configuration = $this->container->get('red_kite_cms.configuration');
             $cmsLanguage = $configuration->read('language');
             $message = $this->container->get('translator')->trans('The template assigned to this page does not exist. This happens when you change a theme with a different number of templates from the active one. To fix this issue you shoud activate the previous theme again and change the pages which cannot be rendered by this theme', array(), 'RedKiteCmsBundle', $cmsLanguage);
             $this->container->get('session')->getFlashBag()->add('notice', $message);
             return $templateTwig;
         }
         if ($themeName != "" && $templateName != "") {
             $this->kernelPath = $this->container->getParameter('kernel.root_dir');
             $templateTwig = is_file(sprintf('%s/Resources/views/%s/%s.html.twig', $this->kernelPath, $themeName, $templateName)) ? sprintf('::%s/%s.html.twig', $themeName, $templateName) : sprintf('%s:Theme:%s.html.twig', $themeName, $templateName);
         }
     }
     return $templateTwig;
 }
コード例 #4
0
 protected function retrieveThemeInfo($theme, $buttons = true)
 {
     $themeName = $theme->getThemeName();
     $asset = new Asset($this->container->get('kernel'), $themeName);
     $info = array('theme_title' => $themeName);
     $fileName = \sprintf('%s/Resources/data/info.yml', $asset->getRealPath());
     if (file_exists($fileName)) {
         $t = Yaml::parse($fileName);
         $info["info"] = \array_intersect_key($t["info"], \array_flip($this->container->getParameter('red_kite_labs_theme_engine.info_valid_entries')));
     }
     $screenshotPath = 'images/screenshot.png';
     $fileName = \sprintf('%s/Resources/public/%s', $asset->getRealPath(), $screenshotPath);
     $info["screenshot"] = file_exists($fileName) ? "/" . $asset->getAbsolutePath() . "/" . $screenshotPath : $this->retriveDefaultScreenshot();
     if ($buttons) {
         $info['buttons'] = $buttons;
     }
     return $info;
 }