You are here

function theme_countryicons_icon in Country Icons 6.2

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

Theme a country icon.

Parameters

$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.

1 theme call to theme_countryicons_icon()
countryicons-help.tpl.php in ./countryicons-help.tpl.php
Help page for countryicons.

File

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

Code

function theme_countryicons_icon($code, $iconset, $alt = '', $title = '', $attributes = NULL, $display_unknown = TRUE) {
  $icon_path = countryicons_get_icon_path($code, $iconset);
  if (!empty($icon_path)) {
    $alt = $alt ? $alt : $code;
    $attributes = $attributes ? $attributes : array();
    $attributes['class'] = 'countryicon iconset-' . $iconset . ' countrycode-' . drupal_strtolower($code) . (empty($attributes['class']) ? '' : ' ' . $attributes['class']);
    return theme('image', $icon_path, $alt, $title, $attributes);
  }
  elseif ($display_unknown) {
    return theme('countryicons_icon', 'unknown', $iconset, $alt, $title, $attributes, FALSE);
  }
}