You are here

function theme_country_icon_adapter in Countries 7.2

Same name and namespace in other branches
  1. 8 countries.module \theme_country_icon_adapter()

Theming function for the Country Icon (country_icon) country field formatter.

1 theme call to theme_country_icon_adapter()
countries_field_formatter_view in ./countries.fields.inc
Implements hook_field_formatter_view().

File

./countries.module, line 924
Defines the field and entity information for countries.

Code

function theme_country_icon_adapter($variables) {
  $country = $variables['country'];
  $icon_set = $variables['settings']['countryiconset'];
  $property = $variables['settings']['property'];
  list($icon_type, $icon_set_name) = explode('_', $icon_set, 2);
  $variables = array(
    'code' => $country->iso2,
    'iconset' => $icon_set_name,
    'alt' => $country->iso2,
    'title' => $country
      ->label(),
  );
  $icon = '';
  if ($icon_type == 'sprite') {
    $icon = theme('countryicons_icon_sprite', $variables);
  }
  elseif ($icon_type == 'icon') {
    $icon = theme('countryicons_icon', $variables);
  }
  if ($property && ($value = country_property($country, $property))) {
    return $icon . ' ' . $value;
  }
  return $icon;
}