You are here

function icon_menu_preprocess_link in Icon API 8

Same name and namespace in other branches
  1. 7 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'];

    // @FIXME
    // theme() has been renamed to _theme() and should NEVER be called directly.
    // Calling _theme() directly can alter the expected output and potentially
    // introduce security issues (see https://www.drupal.org/node/2195739). You
    // should use renderable arrays instead.
    //
    //
    // @see https://www.drupal.org/node/2195739
    // if ($icon = theme('icon', array('bundle' => $settings['bundle'], 'icon' => $settings['icon']))) {
    //       // 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;
    //     }
  }
}