/** * Initialise the view action layout for the page * This includes setting META data, page template and other similar things * * @param Fishpig_AttributeSplashPro_Model_Page $page * @return $this */ protected function _initViewActionLayout(Fishpig_AttributeSplashPro_Model_Page $page) { $customHandles = array('default', 'splash_page_view_' . $page->getId()); if ($template = $page->getTemplate()) { array_push($customHandles, 'page_' . $template, 'splash_page_view_' . strtoupper($template)); } $this->_addCustomLayoutHandles($customHandles); $layout = $this->getLayout(); if (($rootBlock = $layout->getBlock('root')) !== false) { $rootBlock->addBodyClass('splash-page-' . $page->getId()); } if (($headBlock = $layout->getBlock('head')) !== false) { if ($page->getMetaDescription()) { $headBlock->setDescription($page->getMetaDescription()); } if ($page->getMetaKeywords()) { $headBlock->setKeywords($page->getMetaKeywords()); } if ($page->getRobots()) { $headBlock->setRobots($page->getRobots()); } if (Mage::getStoreConfigFlag('splash/seo/use_canonical')) { $headBlock->addItem('link_rel', $page->getUrl(), 'rel="canonical"'); } if (($title = $page->getPageTitle()) !== '') { $headBlock->setTitle($title); } else { $this->_title($page->getName()); } } if (($breadBlock = $layout->getBlock('breadcrumbs')) !== false) { $breadBlock->addCrumb('home', array('link' => Mage::getUrl(), 'label' => $this->__('Home'), 'title' => $this->__('Home'))); if (($categories = $this->_getCategoriesForBreadcrumbs($page)) !== false) { foreach ($categories as $category) { $breadBlock->addCrumb('splash_category_' . $category->getId(), array('link' => $category->getUrl(), 'label' => $category->getName(), 'title' => $category->getName())); } } $breadBlock->addCrumb('splash_page', array('label' => $page->getName(), 'title' => $page->getName())); } // Initialize the messages blocks $this->_initLayoutMessages('core/session'); $this->_initLayoutMessages('checkout/session'); $this->_initLayoutMessages('customer/session'); $this->_initLayoutMessages('catalog/session'); return $this; }