You are here

function i18ntaxonomy_translation_link_alter in Internationalization 6

Implementation of hook_alter_translation_link().

Replaces links with pointers to translated versions of the content.

File

i18ntaxonomy/i18ntaxonomy.module, line 166
i18n taxonomy module

Code

function i18ntaxonomy_translation_link_alter(&$links, $path) {
  if (preg_match("/^(taxonomy\\/term\\/)([^\\/]*)(.*)\$/", $path, $matches)) {

    //or at a taxonomy-listing?
    foreach ($links as $langcode => $link) {
      if ($str_tids = i18ntaxonomy_translation_tids($matches[2], $langcode)) {
        $links[$langcode]['href'] = "taxonomy/term/{$str_tids}" . $matches[3];
      }
    }
  }
}