コード例 #1
0
ファイル: Page.php プロジェクト: bombayworks/currycms
 public function __invoke(Request $request, \Page $page)
 {
     $app = $this->app;
     $pageRevision = $page->getPageRevision();
     // @todo: these are currently unused :S
     $vars = array();
     $options = array();
     // Find language
     $language = $page->getInheritedProperty('Language');
     $fallbackLanguage = $app['fallbackLanguage'];
     if (!$language && $fallbackLanguage) {
         $app->logger->debug('Using fallback language');
         $language = $fallbackLanguage;
     }
     // Set language
     if ($language) {
         $locale = \Curry_Language::setLanguage($language);
         $language = \Curry_Language::getLanguage();
         if ($language) {
             $app->logger->debug('Current language is now ' . $language->getName() . ' (with locale ' . $locale . ')');
         }
     } else {
         $app->logger->debug('Language not set for page');
     }
     // Attempt to render page
     $app->logger->debug('Showing page ' . $page->getName() . ' (PageRevisionId: ' . $pageRevision->getPageRevisionId() . ')');
     $generator = AbstractGenerator::create($app, $pageRevision);
     return $generator->render($vars, $options);
 }
コード例 #2
0
ファイル: PageGenerator.php プロジェクト: varvanin/currycms
 protected function getGlobals()
 {
     $lang = Curry_Language::getLanguage();
     return array('ContentType' => $this->getContentType(), 'Encoding' => $this->getOutputEncoding(), 'language' => $lang ? $lang->toArray() : null, 'page' => $this->pageRevision->getPage()->toTwig(), 'request' => $this->request);
 }
コード例 #3
0
 protected function getGlobals()
 {
     $lang = \Curry_Language::getLanguage();
     return array('language' => $lang ? $lang->toArray() : null, 'page' => $this->pageRevision->getPage()->toTwig());
 }
コード例 #4
0
ファイル: Application.php プロジェクト: varvanin/currycms
 /**
  * Change the active language.
  *
  * @param string|Language $language
  */
 public function setLanguage($language)
 {
     $locale = Curry_Language::setLanguage($language);
     $language = Curry_Language::getLanguage();
     if ($language) {
         trace_notice('Current language is now ' . $language->getName() . ' (with locale ' . $locale . ')');
     }
 }