我正在学习Drupal,我想知道我是否可以更改来自标签云的链接。
来自标签云的链接指向...类别/文章/位置/kitty
我希望它转到...content/kittys的节点标签
有什么想法吗?
发布于 2011-05-26 20:45:09
您为此使用的假设模块tagadelic对此使用默认的分类路径。
所以答案是“是”,它是可以改变的。例如,标签云中的论坛(也是分类中的术语/标签)将链接到论坛主页,而不是论坛概述。这是因为tagadelic使用了taxonomy_term_path()。
然而,你的问题有点不清楚你想要什么(以及为什么)实现这一目标。什么是“内容/小工具”?你的问题让我相信你想链接到一个节点?为什么?标签云代表标签,其中标签链接到该标签中的帖子列表。
也就是说,更改传出链接的简单方法是在theme_function中:到override the theme function。
/**
* theme function that renders the HTML for the tags
* @ingroup themable
*/
function my_custom_chees_puff_theme_tagadelic_weighted($terms) {
$output = '';
foreach ($terms as $term) {
$output .= l($term->name, "/link/to/anywere", array(
'attributes' => array(
'class' => "tagadelic level$term->weight",
'rel' => 'tag',
'title' => $term->description,
)
)
) ." \n";
}
return $output;
}另一种选择是覆盖Drupalwide中的“标签-链接-链接-到”的通用设置。正如前面提到的forum.module所做的,通过hook_term_path()
function my_cheesy_puffs_kitten_module_term_path($term) {
return 'links/to/kittens/' . $term->tid;
}成功!Bèr Kessels - Tagadelic的作者和维护者:)
https://stackoverflow.com/questions/6133511
复制相似问题