You are here

function languageicons_link_alter in Language Icons 6.2

Same name and namespace in other branches
  1. 6 languageicons.module \languageicons_link_alter()

Implementation of hook_link_alter().

Adds language icons to node links.

File

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

Code

function languageicons_link_alter(&$links, $node) {
  if (variable_get('languageicons_show_node', 1) && !empty($node->tnid) && ($translations = module_invoke('translation', 'node_get_translations', $node->tnid))) {
    $languages = language_list();
    foreach ($translations as $langcode => $translation) {
      $index = 'node_translation_' . $langcode;
      if (!empty($links[$index])) {
        languageicons_link_add($links[$index]);
      }
    }
  }
}