You are here

function theme_icon_image in Icon API 8

Same name and namespace in other branches
  1. 7 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))) {

    // @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
    // $output = theme('image', array(
    //       'path' => $image,
    //       'height' => $info['height'],
    //       'width' => $info['width'],
    //       'attributes' => $variables['attributes'],
    //     ));
  }
  return $output;
}