The need to add an icon to a menu item is becoming fairly commonplace, and while menu_icons module exists, it is not really suited for modern iconfont solutions, as it is based on uploading an image to the server.

I've provided a snippet of code here, that works with menu_attributes module to inject special HTML when there is a classname on the link that starts with icon-.

I'm curious if the maintainers would be interested in adding such a feature to this module, before going of to create another module that would have a dependency on this one.

Please have a look at the snippet and let me know if you have any feedback, comments, or suggestions. Thanks!

Comments

pyxio’s picture

This feature would be great. In fact, I think we would only need a prefix field added to menu attributes config that injects some html markup right before the text link... for example <span class="menu-icon-home"></span>. Meantime, I will checkout your solution linked to here.

minimaul’s picture

I agree, a "prefix" field would be really useful.

pyxio’s picture

fyi, I solved this with https://drupal.org/node/1689728#comment-7264544. It works well. Good luck.

minimaul’s picture

Great, thanks, I will have a look at that