You are here

function theme_icon in Icon API 7

Same name and namespace in other branches
  1. 8 includes/theme.inc \theme_icon()

Theming responsibility is always passed to the bundle provider.

Parameters

array $variables: The variables array.

WARNING: This theming hook should never be overridden.

5 theme calls to theme_icon()
icon_block_preprocess_block in modules/icon_block/icon_block.module
Implements hook_preprocess_block().
icon_bundle_list in includes/admin.inc
Menu callback for 'icon_bundle_list'.
icon_field_field_formatter_view in modules/icon_field/icon_field.module
Implements hook_field_formatter_view().
icon_menu_preprocess_link in modules/icon_menu/icon_menu.module
Implements hook_preprocess_link().
_icon_filter in modules/icon_filter/icon_filter.module
Process callback for icon filter.

File

includes/theme.inc, line 123
theme.inc Provides hooks and functions for theme related tasks.

Code

function theme_icon($variables) {
  $output = '';
  $bundle = $variables['bundle'];
  $icon = $variables['icon'];
  if (!empty($bundle) && !empty($icon)) {

    // Render the icon.
    // @todo This should be a render array, but converting the variables to
    // render array properties is needed to do that and this is proxying them.
    $output = theme('icon_' . $bundle['render'], $variables);

    // Wrap icon, if necessary.
    if (($wrapper = $variables['wrapper']) && in_array($wrapper, array_keys(icon_wrapper_options()))) {
      $build = array(
        '#theme' => 'html_tag__icon_wrapper',
        '#tag' => $wrapper,
        '#attributes' => $variables['wrapper_attributes'],
        '#value' => $output,
      );
      $output = drupal_render($build);
    }
  }
  return $output;
}