function theme_icon_RENDER_HOOK in Icon API 8
Same name and namespace in other branches
- 7 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
File
- ./
icon.api.php, line 319 - 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))) {
// @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;
}