function community_tags_link in Community Tags 6.2
Implementation of hook_link(). Add tag links to teasers etc.
File
- ./
community_tags.module, line 243 - Implements community tagging of nodes using a specific vocabulary for Drupal v6.x
Code
function community_tags_link($type, $object, $teaser = FALSE) {
$links = array();
if ($type == 'node') {
if (user_access('tag content')) {
$vids = community_tags_vids_for_node($object);
// filter out any vids that don't have trag links enabled for this content type
foreach ($vids as $vid) {
$settings = _community_tags_get_settings($vid, $object->type);
if ($teaser && empty($settings['tag_links']['teaser']) || !$teaser && empty($settings['tag_links']['full'])) {
unset($vids[$vid]);
}
}
if (count($vids) > 1) {
foreach ($vids as $vid) {
$vocabulary = taxonomy_vocabulary_load($vid);
$link_title = t('Tag this (@name)', array(
'@name' => $vocabulary->name,
));
$links['community_tag-' . $vid] = array(
'title' => $link_title,
'href' => 'community-tags/tag/' . $object->nid . '/' . $vid,
);
}
}
elseif (count($vids) == 1) {
$vid = reset($vids);
$links['community_tag-' . $vid] = array(
'title' => t('Tag this'),
'href' => 'community-tags/tag/' . $object->nid . '/' . $vid,
);
}
}
}
return $links;
}