You are here

function theme_icon_RENDER_HOOK in Icon API 7

Same name and namespace in other branches
  1. 8 icon.api.php \theme_icon_RENDER_HOOK()

Implements theme_icon_RENDER_HOOK().

Return an image of the requested icon.

Parameters

array $variables: An associative array containing:

  • attributes: Associative array of HTML attributes.
  • bundle: An associative array containing various properties.
  • icon: Name of the icon requested from the above bundle.

Return value

string HTML markup for the requested icon.

See also

hook_icon_bundles()

theme_icon_image()

File

./icon.api.php, line 315
icon.api.php Hooks and form elements provided by the Icon API module.

Code

function theme_icon_RENDER_HOOK($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;
}