When using tagadelic together with taxonomy_redirect to redirect specific terms to a view, the Links handled by taxonomy_redirect are loosing weight-information in the css-class-attribute.

This seams to be caused by taxonomy_redirects hook_term_path which refetches the term-data and overwrites the term-object.

To solfe this problem I changed lines 313:

function theme_tagadelic_weighted($terms) {
  $output = '';
  foreach ($terms as $term) {
    $w = $term->weight;
    $output .= l($term->name, taxonomy_term_path($term), array('attributes' => array('class' => "tagadelic level".$w, 'rel' => 'tag'))) ." \n";
  }
  return $output;
}

Maybe this is not the best way to solve this problem but Ithink that solving it in this place should solve simmilar problems with other modules implementing hook_term_path.

CommentFileSizeAuthor
#1 tagadelic_hookfix.patch628 byteslaura s

Comments

laura s’s picture

Status: Active » Needs review
StatusFileSize
new628 bytes

I was seeing the same problem (though I did not narrow it down to a conflict with taxonomy_redirect). This code change works as expected. I rolled it into a patch for convenience of testing.

merilainen’s picture

Works like a dream. I had a problem exactly with that vocabulary which was redirected with taxonomy_redirect.

stg11’s picture

I am using taxonomy redirect but this patch did not fix my tag cloud. It was working for a long time with taxonomy redirect without the patch but suddenly is broken even with the patch. Every item is set to class level0. Other ideas on how to debug or other patch references would be appreciated.

hedac’s picture

thank you.. this patch worked for me. I didn't know why suddenly tagadelic was displaying the weights css class all the same.

dropcube’s picture

Note that is not necessary to patch the module to make it work. You can also override theme_tagadelic_weighted in your theme and use the above code which fixes the bug. Of course, this as temporary solution until the module get fixed.

stg11’s picture

I put the code at the top of this issue into the module and it works now. Thanks everyone.

Bèr Kessels’s picture

Status: Needs review » Needs work

This is most probably an issue with PHP versions. Can anyone confirm that?

kencha’s picture

Nobody will tell you that losing weight is easy. It takes hard work, enthusiasm and perseverance to actually accomplish something.
Trampoline

Bèr Kessels’s picture

Status: Needs work » Closed (won't fix)

Investigated this. Taxonomy-redirect overwrites the tag. That is ugly and should not be done.

OTOH, tagadelic should probably "namespace" the $term->weight as $term->tagadelic_weight. But doing that now will break all custom code and all themed output. That is out of the question. You solution does something similar, albeit less clean. It will introduce the same incompatability-issue.

I call this "won'tfix" since the problem is caused by taxonomy-redirect overwriting terms (regardless) and a (proper) solution on our side requires all users of the module with custom themes (90%?) to modify the code in their theme: in practice, they can no longer update.