hookDisplayBackOfficeHeader | hookActionFrontControllerSetMedia


Add js and css in backoffice header and front end

public function hookDisplayBackOfficeHeader($params)
        {
          $this->context->controller->addJs('modules/'.$this->name.'/views/js/cartbackaccessories.js');

$this->context->controller->addCss('modules/'.$this->name.'/views/js/cartbackaccessories.css');
        }


public function hookActionFrontControllerSetMedia($params)
        {
            $this->context->controller->registerJavascript(
                'frontaccessoriesjs',
                'modules/'.$this->name.'/views/js/frontcartaccessories.js',
                [
                'priority' => 200,
                'attribute' => 'async',
                ]
            );

            $this->context->controller->registerStylesheet(
                'frontaccessoriescss',
                'modules/'.$this->name.'/views/css/front-accessories.css',
                [
                'media' => 'all',
                'priority' => 200,
                ]
            );         
          
        }

Comments

Popular Posts