You are here

function countryicons_get_icon_path in Country Icons 7.2

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

Get the path to an icon.

Parameters

$code: A two letter ISO3166 country code.

$iconset: The icon set to use.

Return value

If icon exists a string containing the path to the image file, else NULL.

2 calls to countryicons_get_icon_path()
countryicons_get_icon_url in ./countryicons.module
Get the URL to an icon.
theme_countryicons_icon in ./countryicons.theme.inc
Theme a country icon.

File

./countryicons.module, line 88
A collection of country icons, and an API for retrieving them.

Code

function countryicons_get_icon_path($code, $iconset) {
  $iconset = countryicons_get_iconset($iconset);
  if (!empty($iconset) && !empty($code)) {
    $icon_path = $iconset->path . '/' . drupal_strtolower($code) . '.' . $iconset->extension;
    if (file_exists($icon_path)) {
      return $icon_path;
    }
  }
}