function theme_countryicons_icon in Country Icons 7.2
Same name and namespace in other branches
- 6.2 countryicons.theme.inc \theme_countryicons_icon()
- 6 countryicons.module \theme_countryicons_icon()
- 7 countryicons.module \theme_countryicons_icon()
Theme a country icon.
Parameters
$variables: An associative array containing:
- code: A two letter ISO3166 country code.
- iconset: The icon set to use.
- alt: The alternative text for text-based browsers (the two letter ISO3166 country code is the default).
- title: The title text is displayed when the image is hovered in some popular browsers.
- attributes: Associative array of attributes to be placed in the img tag.
- display_unknown: If set to TRUE, if a icon don't exists it tries to return a transparant image instead.
Return value
A string containing the image tag.
File
- ./
countryicons.theme.inc, line 25 - Theme functions for the countryicons module.
Code
function theme_countryicons_icon($variables) {
$icon_path = countryicons_get_icon_path($variables['code'], $variables['iconset']);
if (!empty($icon_path)) {
$image = array(
'path' => $icon_path,
'alt' => $variables['alt'] ? $variables['alt'] : $variables['code'],
'title' => $variables['title'],
'attributes' => $attributes = $variables['attributes'] ? $variables['attributes'] : array(),
);
$image['attributes']['class'] = 'countryicon iconset-' . $variables['iconset'] . ' countrycode-' . drupal_strtolower($variables['code']) . (empty($image['attributes']['class']) ? '' : ' ' . $image['attributes']['class']);
return theme('image', $image);
}
elseif ($variables['display_unknown']) {
$var = array(
'code' => 'unknown',
'iconset' => $variables['iconset'],
'attributes' => $variables['attributes'],
'display_unknown' => FALSE,
);
return theme('countryicons_icon', $var);
}
}