You are here

function theme_countryicons_icon_sprite in Country Icons 7.2

Same name and namespace in other branches
  1. 6.2 countryicons.theme.inc \theme_countryicons_icon_sprite()
  2. 6 countryicons.module \theme_countryicons_icon_sprite()
  3. 7 countryicons.module \theme_countryicons_icon_sprite()

Theme a country icon with CSS sprite.

Parameters

$variables: An associative array containing:

  • code: A two letter ISO3166 country code.
  • iconset: The icon set to use.

Return value

A string containing a image tag rendered using a css sprite techniquie.

File

./countryicons.theme.inc, line 60
Theme functions for the countryicons module.

Code

function theme_countryicons_icon_sprite($variables) {
  $code = $variables['code'];
  $iconset = countryicons_get_iconset($variables['iconset']);
  if (!empty($iconset) && $iconset->css_sprite && !empty($code)) {
    drupal_add_css($iconset->css_sprite);
    return '<div class="countryicon-sprite iconset-' . $iconset->key . ' countrycode-' . drupal_strtolower($code) . '"></div>';
  }
}