function fontawesome_preprocess_icon_sprite in Font Awesome Icons 7.2
Same name and namespace in other branches
- 8.2 fontawesome.module \fontawesome_preprocess_icon_sprite()
- 8 fontawesome.module \fontawesome_preprocess_icon_sprite()
- 7.3 fontawesome.module \fontawesome_preprocess_icon_sprite()
- 7 fontawesome.module \fontawesome_preprocess_icon_sprite()
Implements hook_preprocess_icon_RENDER_HOOK().
File
- ./
fontawesome.module, line 122 - fontawesome.module Drupal integration with Font Awesome, the iconic font for use with Bootstrap.
Code
function fontawesome_preprocess_icon_sprite(&$variables) {
$bundle =& $variables['bundle'];
if ($bundle['provider'] === FONTAWESOME_LIBRARY) {
// Remove the default "icon" class.
$key = array_search('icon', $variables['attributes']['class']);
if ($key !== FALSE) {
unset($variables['attributes']['class'][$key]);
}
// Add the necessary FA identifier class.
$variables['attributes']['class'][] = FONTAWESOME_PREFIX;
// Prepend the icon with the FA prefix (which will be used as the class).
$variables['icon'] = FONTAWESOME_PREFIX . '-' . $variables['icon'];
}
}