*/ class FrontHook extends BaseHook { public function onMainContentTop(HookRenderEvent $event) { $view = $this->getView(); if ($this->isAcceptedView($view)) { if($view!=="index"){ $content = $this->render( 'main-content-top.html', [ "ref" => $view, "ref_id" => $this->getRequest()->get( sprintf("%s_id", $view) ), ] ); } else { $content = $this->render( 'main-content-top.html', [ "ref" => 'folder', "ref_id" => '1', ] ); } if (!empty($content)) { $event->add($content); } } } protected function isAcceptedView($view) { $acceptedViews = [ 'category', 'product', 'folder', 'content', 'brand', 'index' ]; return in_array($view, $acceptedViews); } public function onMainJavascriptInitialization (HookRenderEvent $event) { $view = $this->getView(); if ($this->isAcceptedView($view)) { $content = $this->render( 'main-javascript-initialization.html' ); if (!empty($content)) { $event->add($content); } } } public function onMainStylesheet (HookRenderEvent $event) { $view = $this->getView(); if ($this->isAcceptedView($view)) { $content = $this->render( 'main-stylesheet.html' ); if (!empty($content)) { $event->add($content); } } } public function onMainAfterJavascriptInclude (HookRenderEvent $event) { $view = $this->getView(); if ($this->isAcceptedView($view)) { $content = $this->render( 'main-after-javascript-include.html' ); if (!empty($content)) { $event->add($content); } } } }