You are here

function languageicons_link_add in Language Icons 7

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

Add language icon to link.

The language icon may be a different language as the destination page, can be passed in 'language_icon'.

1 call to languageicons_link_add()
languageicons_language_switch_links_alter in ./languageicons.module
Implements hook_language_switch_links_alter().

File

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

Code

function languageicons_link_add(&$link, $title = NULL) {
  $language = isset($link['language_icon']) ? $link['language_icon'] : $link['language'];
  $title = $title ? $title : $link['title'];
  $icon = theme('languageicons_icon', array(
    'language' => $language,
    'title' => check_plain($title),
  ));
  if ($icon) {
    $link['title'] = theme('languageicons_place', array(
      'text' => check_plain($link['title']),
      'icon' => $icon,
    ));
    $link['html'] = TRUE;
  }
}