Jump to content

Greffer un module sur des hooks


Buzut

Recommended Posts

Bonjour à tous,

Sur certains modules, les hooks sont pas greffages, bien qu'ils apparaissent dans Apparence > Position pour le module en question.

Lorsque je clique sur "Greffer un module", il ne sont ni disponibles, ni déjà enregistrés.

 

<?php
class MyHomeslider extends Module {

    public function __construct () {
        $this->name = 'myhomeslider';
        $this->author = 'me';
        $this->version = '1.0.0';
        $this->bootstrap = true;
        parent::__construct();
        $this->displayName = $this->l('My Home Slider');
        $this->description = $this->l('Custom Full-width Home Slider');
        $this->ps_versions_compliancy = array('min' => '1.7.0.0', 'max' => '1.7.99.99');
    }

    public function install() {
        return parent::install()
        && $this->registerHook('displayHome')
        && $this->registerHook('backOfficeHeader')
        && $this->registerHook('displayBackOfficeHeader')
        && $this->registerHook('displayNavFullWidth');
    }

    public function uninstall() {
        return parent::uninstall();
    }

    public function hookDisplayHome() {
        
        return $this->display(__FILE__, 'views/templates/hook/homeslider.tpl');
    }
  
    public function hookHeader() {
        $this->context->controller->addCSS($this->_path.'views/css/homeslider.css');
    }

    public function getContent() {
        

        return $this->display(__FILE__, 'views/templates/admin/config.tpl');
    }
    public function hookBackOfficeHeader() {
        $this->context->controller->addCSS($this->_path.'/views/css/homeslider.css');
        $this->context->controller->addJS($this->_path.'/views/js/homeslider.js');
    }

    public function hookDisplayBackOfficeHeader() {
        $this->hookBackOfficeHeader();
    }
}

Est-ce que je suis passé à côté d'un truc ?

 

Merci d'avance !

Quentin

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...