function fontawesome_preprocess_icon_sprite in Font Awesome Icons 8
Same name and namespace in other branches
- 8.2 fontawesome.module \fontawesome_preprocess_icon_sprite()
- 7.3 fontawesome.module \fontawesome_preprocess_icon_sprite()
- 7 fontawesome.module \fontawesome_preprocess_icon_sprite()
- 7.2 fontawesome.module \fontawesome_preprocess_icon_sprite()
Implements hook_preprocess_icon_RENDER_HOOK().
File
- ./
fontawesome.module, line 118 - 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') {
// 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'][] = 'fa';
// Prepend the icon with the FA prefix (which will be used as the class).
$variables['icon'] = 'fa-' . $variables['icon'];
}
}