function icon_preprocess_icon_sprite in Icon API 8
Same name and namespace in other branches
- 7 includes/render.inc \icon_preprocess_icon_sprite()
Implements hook_preprocess_icon_RENDER_HOOK().
File
- includes/
render.inc, line 78 - render.inc Provides hooks and theme callbacks for default render hooks. @TODO add a "sprite" render hook.
Code
function icon_preprocess_icon_sprite(&$variables) {
$bundle =& $variables['bundle'];
$icon =& $variables['icon'];
// Add default settings.
if (!isset($bundle['settings']['tag'])) {
$bundle['settings']['tag'] = 'span';
}
if (!isset($bundle['settings']['content'])) {
$bundle['settings']['content'] = '';
}
// Sanitize and add icon class here. Don't need to check for numeric because
// these are already CSS class name based.
$variables['attributes']['class'][] = \Drupal\Component\Utility\Html::getClass($icon);
}