You are here

function theme_languageicons_icon in Language Icons 6

Same name and namespace in other branches
  1. 6.2 languageicons.module \theme_languageicons_icon()
  2. 7 languageicons.module \theme_languageicons_icon()

Theme language icon.

This function can be overridden for no language icons.

1 theme call to theme_languageicons_icon()
languageicons_link_add in ./languageicons.module
Add language icon to link.

File

./languageicons.module, line 119
Icons for language links.

Code

function theme_languageicons_icon($language, $title = NULL) {
  if ($path = variable_get('languageicons_path', drupal_get_path('module', 'languageicons') . '/flags/*.png')) {
    $src = base_path() . str_replace('*', $language->language, $path);
    $title = $title ? $title : $language->native;
    $attribs = array(
      'class' => 'language-icon',
      'alt' => $title,
    );
    if ($size = variable_get('languageicons_size', '16x12')) {
      list($width, $height) = explode('x', $size);
      $attribs += array(
        'width' => $width,
        'height' => $height,
      );
    }
    return "<img src='{$src}' " . drupal_attributes($attribs) . ' />';
  }
}