Commit ebde898f authored by lphuberdeau's avatar lphuberdeau

[MOD] Allow object link to display freetag link

parent d9d1a453
......@@ -800,6 +800,13 @@ class FreetagLib extends ObjectLib
return $this->getOne($query, array($tag));
}
function get_tag_from_id($tagId)
{
return $this->table('tiki_freetags')->fetchOne('tag', array(
'tagId' => $tagId,
));
}
/**
* get_raw_tag_id
*
......
......@@ -49,6 +49,9 @@ function smarty_function_object_link( $params, $smarty ) {
case 'relation_target':
$function = 'smarty_function_object_link_relation_target';
break;
case 'freetag':
$function = 'smarty_function_object_link_freetag';
break;
default:
$function = 'smarty_function_object_link_default';
break;
......@@ -193,3 +196,16 @@ function smarty_function_object_link_relation_end( $smarty, $end, $relationId, $
return $out;
}
function smarty_function_object_link_freetag( $smarty, $tag, $title = null ) {
global $prefs;
if ($prefs['feature_freetags'] != 'y') {
return tr('freetags disabled');
}
if (is_numeric($tag)) {
$tag = TikiLib::lib('freetag')->get_tag_from_id($tag);
}
return smarty_function_object_link_default($smarty, $tag, $tag, 'freetag');
}
......@@ -89,6 +89,9 @@ function smarty_modifier_sefurl($source, $type='wiki', $with_next = '', $all_lan
case 'category':
$href = $sefurl ? "cat$source": "tiki-browse_categories.php?parentId=$source";
break;
case 'freetag':
$href = "tiki-browse_freetags.php?tag=" . urlencode($source);
break;
default:
$href = $source;
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment