Skip to main content

Taxonomy Icon Classes

July 2015

This Drupal module provides a formatter for Taxonomy term reference fields, that allows you to display an icon corresponding to each of the terms. You create taxonomy terms that correspond to your icon classes, minus the prefixes, and the module will spit them out as HTML <i> tags with the correct classes applied.

The module is style agnostic in its implementation; it only creates HTML markup. You could use either images or icon fonts in your theme's CSS, or install a module such as Font Awesome Icons to provide the styles to actually show the icons.

The module has configurable settings that allow you to customize it depending on the naming convention your icon classes expect:

  • Class prefix: the prefix for the icon itself. i.e 'icon-', 'fa fa-', 'glyphicon glyphicon-'
  • Icon size prefix: the prefix for the icon sizing classes: i.e 'icon-', 'fa-'
  • Icon size: the size that you want the icons to be displayed at. Sizes provided: 1x (default, use this to omit the size class), lg, 2x, 3x, 4x, 5x

Project Page (drupal.org)