Jump to content

Comment modifier les CSS admin lors d'une création de module prestashop 1.7


Recommended Posts

Bonjour,

Je suis en train de créer un module sur prestashop 1.7 et je souhaiterais modifier les css du module, côté ADMIN.

Dans mon fichier principal .php j'ai fais un hook :

	public function install()
	{
		if (Shop::isFeatureActive()){
			Shop::setContext(Shop::CONTEXT_ALL);
		}

		if (!parent::install() ||
			!$this->registerHook('header') ||
			!Configuration::updateValue('MYMODULE_PRESTA', 'Module presta')
		)
			return false;
		return true && $this->registerHook('backOfficeHeader');
	}

	public function hookBackOfficeHeader(){
			$this->getContext()->controller->addCSS($this->_path.'views/css/modulepresta.css');
	}

Du coup ça ne fonctionne pas, donc j'ai créé un controller admin :

<?php

class AdminModulePresta extends ModuleAdminController
{
    public function __construct()
    {
        $this->bootstrap = true;
        $this->className = 'AdminModulePrestaController';
        include_once(_PS_MODULE_DIR_ . '/modulepresta/modulepresta.php');
        parent::__construct();
    }
    public function setMedia() {
        parent::setMedia();
        $this->path = __PS_BASE_URI__.'modules/modulepresta/';
        
        $this->context->controller->addCSS($this->path . 'views/css/modulepresta.css');


        // $this->context->controller->addJS($this->path . 'js/lib/jquery.mousewheel.js');

    }

    public function init()
    {
        parent::init();
    }

}

Mais ça ne fonctionne toujours pas.

 

Je vous envoie un écran du module ci-dessous, je souhaiterais juste mettre un display:flex en CSS sur mes Checkbox et boutons radio.

image.png.3b32389051577ec28a771dafcf21ccb1.png

 

Si vous auriez des suggestions ça m'aiderais.

Je vous remercie.

Link to comment
Share on other sites

I found it out.

It was just in my install() function, it wasn't complete :

 

Here is the good code :

	public function install()
	{
		if (Shop::isFeatureActive()){
			Shop::setContext(Shop::CONTEXT_ALL);
		}

		if (!parent::install() ||
			!$this->registerHook('header') ||
			!$this->registerHook('backOfficeHeader') ||
			!Configuration::updateValue('MYMODULE_PRESTA', 'Module presta')
		)
			return false;
		return true && ($this->registerHook('displayHeader') || $this->registerHook('backOfficeHeader'));
	}

 

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...