/** * Processes response for the handled Blog page * * @param Page $page * @return string * @throws \Exception */ protected function processBlogPage(Page $page) { $dispatchedPage = $page->getDispatchedBlock(); if ($dispatchedPage) { /* Check the route to identify the blog page type index or post */ // TODO: implement as a separate routine that has a list of routes for listofposts page $pageIsBlogpost = count(explode('/', $page->getRoute())) > 1; $defaultTemplate = $pageIsBlogpost ? 'blogpost.blade.php' : 'blog.blade.php'; $this->setTemplatesProcessor(new TemplatesProcessor($defaultTemplate)); $this->rawView = $this->templatesProcessor->applyPageBlocksTemplates($dispatchedPage); $this->renderer = new Renderer($this->templatesProcessor->getResultViewParams()); if (!$pageIsBlogpost) { $this->renderer->collectListOfPosts($page); } $this->renderer->setNavigationItems($page->getNavigationItems()); } else { throw new \Exception("No CMS page has been dispatched"); } }
/** * Processes response for the handled CMS page * * @param Page $page * @throws \Exception */ protected function processCmsPage(Page $page) { $dispatchedPage = $page->getDispatchedBlock(); if ($dispatchedPage) { $this->setTemplatesProcessor(new TemplatesProcessor('default.blade.php')); $this->rawView = $this->templatesProcessor->applyPageBlocksTemplates($dispatchedPage); $this->renderer = new Renderer($this->templatesProcessor->getResultViewParams()); $this->renderer->setNavigationItems($page->getNavigationItems()); } else { throw new \Exception("No CMS page has been dispatched"); } }
/** * Processes response for the handled CMS page * * @param Page $page * @return string * @throws \Exception */ protected function processCmsPage(Page $page) { $dispatchedPage = $page->getDispatchedBlock(); if ($dispatchedPage) { $view = $this->templatesProcessor->applyPageBlocksTemplates($dispatchedPage); $response = view($view, $this->templatesProcessor->getResultViewParams())->render(); return $response; } else { throw new \Exception("No CMS page has been dispatched"); } }