function icon_menu_preprocess_link in Icon API 7
Same name and namespace in other branches
- 8 modules/icon_menu/icon_menu.module \icon_menu_preprocess_link()
Implements hook_preprocess_link().
File
- modules/
icon_menu/ icon_menu.module, line 55 - icon_menu.module Implements an API for icon providers and an administrative UI for integrating icons through out the site.
Code
function icon_menu_preprocess_link(&$variables) {
if (!empty($variables['options']) && !empty($variables['options']['icon']) && !empty($variables['options']['icon']['bundle']) && !empty($variables['options']['icon']['icon']) && (empty($variables['options']['icon']['processed']) || !$variables['options']['icon']['processed'])) {
$settings = $variables['options']['icon'];
if ($icon = theme('icon', $settings)) {
// Force link to render HTML.
$variables['options']['html'] = TRUE;
if ($settings['title_wrapper']) {
$variables['text'] = '<' . $settings['title_wrapper_element'] . (!empty($settings['title_wrapper_class']) ? ' class="' . $settings['title_wrapper_class'] . '"' : '') . '>' . $variables['text'] . '</' . $settings['title_wrapper_element'] . '>';
}
switch ($variables['options']['icon']['position']) {
case 'title_before':
$variables['text'] = $icon . $variables['text'];
break;
case 'title_after':
$variables['text'] .= $icon;
break;
case 'title_invisible':
$variables['text'] = $icon . '<span class="element-invisible element-focusable">' . $variables['text'] . '</span>';
break;
case 'title_replace':
$variables['text'] = $icon;
break;
}
$variables['options']['icon']['processed'] = TRUE;
}
}
}