function translation_taxonomy_tids in Internationalization 5.2
Same name and namespace in other branches
- 5.3 translation/translation.module \translation_taxonomy_tids()
- 5 translation/translation.module \translation_taxonomy_tids()
Returns an url for the translated taxonomy-page, if exists
1 call to translation_taxonomy_tids()
- translation_url in translation/
translation.module - Produces url of translated page
File
- translation/
translation.module, line 1163
Code
function translation_taxonomy_tids($str_tids, $lang) {
if (preg_match('/^([0-9]+[+ ])+[0-9]+$/', $str_tids)) {
$separator = '+';
// The '+' character in a query string may be parsed as ' '.
$tids = preg_split('/[+ ]/', $str_tids);
}
else {
if (preg_match('/^([0-9]+,)*[0-9]+$/', $str_tids)) {
$separator = ',';
$tids = explode(',', $str_tids);
}
else {
return;
}
}
$translated_tids = array();
foreach ($tids as $tid) {
if ($translated_tid = translation_term_tid($tid, $lang)) {
$translated_tids[] = $translated_tid;
}
}
return implode($separator, $translated_tids);
}