New module main menu Icon

Hi all…
Could anybody tell me where should I edit/add modMymodule.class.php (or maybe another file) to declare mainmenuicon?
I’ve been looking arround with no luck…
I was able to declare icon just for the module configuration page.
Thanks in advance.
Ale

You will find into file thme/eldy/styles.css.php the logic used to define style for menu icon.
If your top menu url is
xx?mainmenu=mymodule
then styles.css.php will look automatically to file /mymodule/img/mymodule.png to use for top menu icon.

Thanks again Eldy!!

I’ve tried another solution, i think that it’s more simple and even more effective, specially if you have enabled the use of Fontwaesome icons on Dolibarr (default is YES).

  1. Check the value of attribute ‘mainmenu’ when defining the top menu entry in the PHP class file for your module (/custom/MyModule/core/modules/modMyModule.class.php). In my case is “contabilidad”

  2. Visit this webpage and decide which fontawesome icon you like more:

https://fontawesome.com/v4.7.0/icons/

  1. Click on the icon you like and in the new page copy the “unicode” for that icon. For example: “f1ec” (for calculator icon)

  2. add this line to the CSS file on your theme(s) for fontawesome (in fact you can add it also to any other CSS file of your theme):

div.mainmenu.contabilidad::before { content: "\f1ec"; }

Voilà !! Be sure to remove browser cache to see changes on the to menu bar of Dolibarr :wink:

Hi caos30,

How do we do the same for Left menu please…?

I tried this without luck: a.vmenu.Visual Query::before { content: “\f1c0”; }

Kindly refer to

and help please…

thanks and regards,
yesbee

I’ve answered to you on that other ticket. I hope you get it run, i got it.
Cheers.

Hello !

I want to add a background image for my new module , I tried this in the css file :
div.mainmenu.gestiondesdocuments {
background-color : #ffffff;
}

and this :

div.mainmenu.gestiondesdocuments {
background-image : url(“paper.png”);
}

but it’s not working :weary:

Could you please tell how it works ?