/** * Do something after content is loaded from DB * * @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page */ public function postContentLoad(\Cx\Core\ContentManager\Model\Entity\Page $page) { switch ($this->cx->getMode()) { case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND: // Show the Shop navbar in the Shop, or on every page if configured to do so if (!Shop::isInitialized()) { \Cx\Core\Setting\Controller\Setting::init('Shop', 'config'); if (\Cx\Core\Setting\Controller\Setting::getValue('shopnavbar_on_all_pages', 'Shop')) { Shop::init(); Shop::setNavbar(); } } break; } }
/** * Do something after content is loaded from DB * * @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page */ public function postContentLoad(\Cx\Core\ContentManager\Model\Entity\Page $page) { switch ($this->cx->getMode()) { case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND: // Show the Shop navbar in the Shop, or on every page if configured to do so if (!Shop::isInitialized()) { \Cx\Core\Setting\Controller\Setting::init('Shop', 'config'); if (\Cx\Core\Setting\Controller\Setting::getValue('shopnavbar_on_all_pages', 'Shop')) { Shop::init(); Shop::setNavbar(); } // replace global product blocks $page->setContent(preg_replace_callback('/<!--\\s+BEGIN\\s+(block_shop_products_category_(?:\\d+)\\s+-->).*<!--\\s+END\\s+\\1/s', function ($matches) { $blockTemplate = new \Cx\Core\Html\Sigma(); $blockTemplate->setTemplate($matches[0]); Shop::parse_products_blocks($blockTemplate); return $blockTemplate->get(); }, $page->getContent())); } break; } }