I've noticed that when a certain term matches only a single node, TagClouds attempts to link that term to that node.
However, instead of this happening, the term links to the term the ID of which corresponds with the node ID.
(e.g. when term 2 is tagged in only one node, which is node 4, the term links to term 4 instead of node 4).
The culprit code is:
function tagclouds_display_node_link_count($name, $nid, $count, $description) {
$node_info = entity_get_info('taxonomy_term');
if ($node = $node_info['load hook']($nid)) {
$uri = $node_info['uri callback']($node);
$uri['options']['attributes']['class'][] = 'tagclouds';
$uri['options']['attributes']['rel'] = 'tag';
$uri['options']['attributes']['title'] = $description;
return l($name, $uri['path'], $uri['options']);
}
}
This ought to be changed to:
function tagclouds_display_node_link_count($name, $tid, $nid, $count, $description) {
if ($term = taxonomy_term_load($tid) && $node = node_load($nid)) {
$uri = entity_uri('node', $node);
$uri['options']['attributes']['class'][] = 'tagclouds';
$uri['options']['attributes']['rel'] = 'tag';
$uri['options']['attributes']['title'] = $description;
return l($name, $uri['path'], $uri['options']);
}
}
Also, the additional function parameter has to be added when calling in line 341:
$output .= tagclouds_display_node_link_count($term->name, $term->tid, $term->nid, $term->count, $term->description);
However, I feel that this "linking to node" functionality should be optional, so I also included an extension to the administrative page to the patch I've linked to fix this bug allowing users to switch between linking to nodes and term pages.
| Comment | File | Size | Author |
|---|---|---|---|
| tagclouds-term-node-link.patch | 2.22 KB | karsa |
Comments
Comment #1
MGParisi commentedI just released a new dev version so and was working on a simular issue, let me step into this and apply your patch and re-release a new dev version.
I probably will need another .patch when I am done with these changes and tested it for the added admin functionality. The admin functionality will have to default on upgrade to node view. I would also need a written change to the readme file as it sucks already and if we keep changing things it will continue to suck!
Comment #2
MGParisi commentedApplied, I think this is the final fix for #1705418: New Tags Not Appearing in Cloud needed!
Please test and open a new issue for the changes to Admin. Right now I am trying to solve #1705418: New Tags Not Appearing in Cloud too, and its directly related to your issues. But you will notice some additional changes made to the code.
BTW, it may take an hour or more for the next dev to appear.
Comment #3
MGParisi commentedThe New Dev Is Up!
Comment #4
MGParisi commentedfixed