You are here

function theme_icon_image in Icon API 7

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

Implements theme_icon_RENDER_HOOK().

Return an image of the requested icon.

File

includes/render.inc, line 50
render.inc Provides hooks and theme callbacks for default render hooks. @TODO add a "sprite" render hook.

Code

function theme_icon_image($variables) {
  $output = '';
  $bundle = $variables['bundle'];
  $icon = $variables['icon'];
  $image = $bundle['path'] . '/' . $icon . '.' . $bundle['settings']['extension'];
  if (file_exists($image) && ($info = image_get_info($image))) {
    $output = theme('image', array(
      'path' => $image,
      'height' => $info['height'],
      'width' => $info['width'],
      'attributes' => $variables['attributes'],
    ));
  }
  return $output;
}