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: