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).
-
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”
-
Visit this webpage and decide which fontawesome icon you like more:
https://fontawesome.com/v4.7.0/icons/
-
Click on the icon you like and in the new page copy the “unicode” for that icon. For example: “f1ec” (for calculator icon)
-
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