_icons.php
/cong/_icons.php
defines the generic icons that are made available to the whole application (including all skins and plugins).
In recent versions of b2evolution the icons refer to a glyph in an icon font. The preferred icon font is Font Awesome. The correct icon name ro use in that font is defined by 'fa'
.
Alternatively we have also defined icons in the Glyph Icons font used by bootstrap. The correct icon name to use in that font is defined by 'glyph'
.
In previous versions, and as a fallback for old skins, the icons are also available as graphics in a sprite image. So each icon is also defined by it’s x-y coordinates on the sprite and its size in pixels.
An alt text can also be defined for each icon.
Usage in skins
Use get_icon()
to obtain HTML code for displaying an icon.
If you want to use an icon font, you need to tell b2evolution (for example in Skin::display_init()
) like this:
// Use font-awesome icons, @see get_icon()
global $b2evo_icons_type;
$b2evo_icons_type = 'fontawesome'; // alternatively : 'glyph'
Of course you also need to require_css
the proper CSS provided by the font maker. For example:
// Load Font Awesome:
require_css( 'http://netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.css' );