You are here

function theme_languageicons_icon in Language Icons 7

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

Theme language icon.

This function can be overridden for no language icons.

@seealso theme_image()

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

File

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

Code

function theme_languageicons_icon($variables) {
  $language = $variables['language'];
  $title = $variables['title'];
  if ($path = variable_get('languageicons_path', drupal_get_path('module', 'languageicons') . '/flags/*.png')) {
    $title = $title ? $title : $language->native;

    // Build up $image for theme_image() consumption.
    $image = array(
      'path' => str_replace('*', $language->language, check_plain($path)),
      'alt' => $title,
      'title' => $title,
      'attributes' => array(
        'class' => array(
          'language-icon',
        ),
      ),
    );
    if ($size = check_plain(variable_get('languageicons_size', '16x12'))) {
      list($width, $height) = explode('x', $size);
      $image += array(
        'width' => $width,
        'height' => $height,
      );
    }
    return theme('image', $image);
  }
}