Active
Project:
Localizer
Version:
5.x-1.10
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
13 Dec 2007 at 09:28 UTC
Updated:
13 Dec 2007 at 09:28 UTC
On all languages terms display on main language... But this code fixed it, and need this add to patch...
<?php
/**
* Implementation of hook_link().
*
* This hook is extended with $type = 'taxonomy terms' to allow themes to
* print lists of terms associated with a node. Themes can print taxonomy
* links with:
*
* if (module_exists('taxonomy')) {
* $terms = taxonomy_link('taxonomy terms', $node);
* print theme('links', $terms);
* }
*/
function taxonomy_link($type, $node = NULL) {
if ($type == 'taxonomy terms' && $node != NULL) {
$links = array();
if (array_key_exists('taxonomy', $node)) {
foreach ($node->taxonomy as $term) {
// added 6 lines
$nameTranslate = $term->name;
$result = mysql_query('select translation from localizertranslation where object_key="' . $term->tid . '" and object_name="taxonomy_term" and object_field="name" and locale="' . $GLOBALS['locale'] . '";');
$sovpad = mysql_num_rows($result);
if ($sovpad > 0) {
$nameTranslate = mysql_result($result, 0, 'translation');
}
$links['taxonomy_term_'. $term->tid] = array(
'title' => $nameTranslate, // replace $term->name to $nameTranslate
'href' => taxonomy_term_path($term),
'attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description))
);
}
}
// We call this hook again because some modules and themes call taxonomy_link('taxonomy terms') directly
foreach (module_implements('link_alter') as $module) {
$function = $module .'_link_alter';
$function($node, $links);
}
return $links;
}
}
?>
P.S. sorry if this bug already reported, but i not found on this site, and sorry, my english is very bad...