Hello 👋🏼 , how can I add an icon to my new module?

image
I want to change this icon.

1 Like

Any solution? I hv the same problem

Hello,

unfortunately I haven’t found the solution yet but I’m still looking.

Good luck !

1 Like

Hello,

You need to define the picto of the module :

		// Name of image file used for this module.
		// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
		// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
		// To use a supported fa-xxx css style of font awesome, use this->picto='xxx'
		$this->picto = 'generic';

Hello. everyone.

in the modMyModule.class.php.

in line $this->picto = ‘’; // You have to change to change this to this : $this->picto = “pictoname@myobject”.

Per example. I made a module in Module buider. And My module name in Trucks. Now you have to go to module folder /custom/trucks/img.

Now check the name of the file have to be object_trucks.png and object_trucks_over.png.

Then whe have to change it like this : $this->picto = “trucks@trucks”.

This changes will make the image in modules are in config will change. But you need to delete cookies and cache to see the changes.

If you want to add an icon in yout left menus you need to add a line in the menu:

inside:

$this->menu[$r++] = array(
       ...
       'type'=>'left',
       'titre'=>'ObjectTitle',
   'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth valignmiddle"'),

I hope it helps you