Example #1
0
 public function bodyCssClass()
 {
     $page = WasabiCms::page();
     $classes = [];
     $classes[] = 'layout-' . Inflector::dasherize($page->layout);
     $classes[] = 'page-' . Inflector::dasherize($page->slug);
     return implode(' ', $classes);
 }
Example #2
0
 public function view($pageId, $languageId, $pageNumber)
 {
     Wasabi::loadLanguages($languageId);
     $this->loadModel('Wasabi/Cms.Pages');
     $page = $this->Pages->getForFrontend($pageId);
     $startPage = $this->Pages->getStartPage();
     $titleSuffix = Configure::read('Settings.Core.html_title_suffix');
     $instanceName = Configure::read('Settings.Core.instance_name');
     WasabiCms::page($page);
     WasabiCms::startPage($startPage);
     WasabiCms::titleSuffix($titleSuffix);
     WasabiCms::instanceName($instanceName);
     $page->initializeContentAreas();
     $this->viewBuilder()->theme($page->getTheme()->getNameForViewBuilder());
     $this->viewBuilder()->layout($page->getLayout()->name());
     $this->viewBuilder()->className($page->getTheme()->getViewClassNameForViewBuilder());
     $this->set(['page' => $page]);
 }
Example #3
0
 public function isMenuItemActive(Event $event, Request $request)
 {
     /** @var MenuItem $menuItem */
     $menuItem = $event->subject();
     $pageId = $menuItem->get('Pages')['id'] ?? null;
     if ($menuItem->foreign_model !== 'Wasabi/Cms.Pages' || $pageId === null) {
         return;
     }
     if ((int) $pageId === WasabiCms::page()->id) {
         $event->result = true;
         $event->stopPropagation();
     }
 }