I have a module that depends on Community Tags (CT) block in a Panel and when I tried to use CT it wouldn't work. It seems that the CT module uses D6 Tagadelic functions, but that the Tagadelic module has been rewritten. I wrote a patch to eliminate the issues. Please let me know if my patch can be integrated into the Community Tags module, so that people who use my module don't have to necessarily worry about the patch.

community_tags.module (line 552):
This line is probably a remnant from the D6 version because it doesn't make sense to load the $node from $node. The $node variable is passed as an argument to the _community_tags_node_view function in D7.

<?php
if (is_numeric($node)) {
  $node = node_load($node);
}
?>

community_tags.module (line 538-540):
This is a D6 specific Tagadelic function.

<?php
$weighted_tags = tagadelic_build_weighted_tags($tags);
?>

I replaced it with the D7 Tagadelic Tag and Cloud objects.

<?php
foreach($tags as $tag_object) {
    $weighted_tags[] = new TagadelicTag($tag_object->name, $tag_object->name, $tag_object->count);
}
$tagadelic_cloud = new TagadelicCloud("community_tags_cloud", $weighted_tags);

$output = "";
foreach($tagadelic_cloud->get_tags() as $tag) {
  $output .= $tag;
}
return theme('community_tags', array('tags' => $output));
?>

community_tags.module (line 566):
I removed this line, since it seems to be a D6 specific Tagadelic function.

<?php
$sorted_tags = tagadelic_sort_tags($weighted_tags);
?>

community_tags.js (line 65):
The button would not render correctly unless it was assigned class form-submit. Class form-button might have been a remnant from D6.

var button = $('<input type="button" class="form-button" value="'+ Drupal.communityTags.checkPlain(o.add) +'" />').click(addHandler);

The above fixed the main issues. However, one remaining problem I had was that the Tagadelic stylesheet (tagadelic.css) is not being linked automatically and I am not sure how to resolve that or if it is even a CT problem or a Tagadelic problem. My module requires Tagadelic as a dependency, so I don't see why the stylesheet shouldn't be part of the page call. Without the Tagadelic stylesheet the tag cloud is missing styles such as font sizes and padding for the spacing between words. Maybe you can guide me into a good direction to remove this obstacle.

Please see the attached patch file.

Comments

nsuit’s picture

nsuit’s picture

Priority: Major » Minor
Status: Needs work » Closed (fixed)

The tags didn't display because of a theme and not because of the Community Tags code.

nsuit’s picture

Status: Closed (fixed) » Closed (works as designed)

Changed status.

nsuit’s picture

Status: Closed (works as designed) » Patch (to be ported)
StatusFileSize
new1.94 KB

I installed a fresh install of community tags the module would not work without my patch. Someone else who is using the Community tags module reported the same problem to me. The error is caused by the use of Tagadelic D6 functions in the Community tags D7 version.
The code that needed to be replaced was in community_tags.module line 538-540 and line 566. See my latest submitted patch. I really hope that this patch could be adopted into the module code. I have been recommending the Community tags module to our clients and my module has a dependency on community_tags. Thank you for creating this module.

nsuit’s picture

Priority: Minor » Major
Status: Patch (to be ported) » Needs review

Changed the status.

nsuit’s picture

Status: Needs review » Needs work