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); }
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); }
protected function getGlobals() { $lang = \Curry_Language::getLanguage(); return array('language' => $lang ? $lang->toArray() : null, 'page' => $this->pageRevision->getPage()->toTwig()); }
/** * 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 . ')'); } }