Download & Extend

taxonomy_link() typo (was: Views: Taxonomy: Terms for [my container] show nothing)

Project:Category
Version:4.7.x-1.x-dev
Component:Wrapper modules
Category:bug report
Priority:critical
Assigned:bdragon
Status:closed (fixed)

Issue Summary

Actually selecting Taxonomy: Terms for [my container] as a field displays nothing.

Category and Views latest versions, taxonomy_wrapper and category_views enabled, Drupal 4.7.2

Does this patch aim at solving this issue?

thx

Comments

#1

Status:active» needs review

Found a bug in the taxonomy wrapper that was returning the wrong value to views when displaying any taxonomy link, including terms (all terms) and terms (my term). I compared what the category module taxonomy wrapper was returning compared to what the original taxonomy module was returning and made the attached fix which gets everything working right. I am pretty sure this will fix the problem and not break anything else, but it would be good for others to confirm that.

AttachmentSize
taxonomy.module.copyme.patch 799 bytes

#2

KarenS, thanks, applied the patch and works sweet now!

Also that patch on my comment above (an extra category_views_integration.module actually) solved the problem, but this is much cleaner and is always good to turn another mod off ;)

#3

kiteatlas, are you saying that this patch makes that other one unnecessary? I thought that other patch made a fuller integration with views module possible. Sure, you can always generate a view using taxonomy terms as the wrapper module maintains the term data in the table anyway, but isn't it nicer to have category appear on its own on the views module form page?

I am asking because I really don't know.

#4

well, i switched off the category_views_integration module and applied KarenS patch and my views that use 'Term' as fields or arguments work just fine...!

so looks to me that when it comes to modules, less really is more in terms of speed (less php queries) and tidyness (less menus, modules listed on mods page, ..).

The Taxonomy wrapper is the guy supposed to take care of Category integration, so i prefer not to enable yet another module just to fill a hole that a patch can solve...

Yep, i understand how hard is for Category lovers to see it always in the shade of the elder brother Taxonomy, but in the end untill others will understand it's real goodnes it just takes to remember that "categories" are "terms" and "containers" are "vocabularies" ;)

#5

Don't lose sight of the fact that the taxomony wrapper is actually broken and needs this patch anyway. This is not a feature addition, it's a bug fix. The unpatched wrapper returns something totally different than the regular taxonomy module, which it should not do. Views may not be the only module that is affected, it's just the only one I have run into so far.

The question of whether this is all you need depends on whether or not you are using the wrapper. If so, the patched wrapper may suffice. If not, you may need the other module.

#6

Thanks! It seems almost certain that Jaza will commit your patch when he returns from vacation.

It does seem redundant to use the views_integration patch if your patch for taxonomy wrapper provides the same functionality by way of a bug fix. I suppose one could say that a more robust module is better than merely having 'category' or 'container' show up in the views form instead of taxonomy.

It wasn't quite clear, though, if you meant to say that it ISN'T necessary to use the taxo_wrapper module for using taxo based modules together with category. Or, did I misunderstand you?

#7

No, I was just saying not everyone is using the wrapper. If you want Views to pick up categories and treat them like terms, I think you'll need the wrapper. If you don't use the wrapper I don't know what you'll get (I am using it so I don't know what happens if you don't use it.)

#8

I use following snippet for links in links.tpl.php

<?php


 
/**
* to change the delimiter, just modify the $delimiter value
* Add in other fixed links to the link array by adding something like
* $links[] = l('link text', 'link path');
*
*/

$delimiter = " ";

// Display the left cap of the 'button bar'
$link_count = count($links);
$current = 1;
foreach (
$links as $lnk ) {
       
// Print the link
   
print $lnk;
       
// Only print the delimiter if not the last link
   
if ( $current < $link_count ) {
        print
$delimiter;
    }
   
$current++;
}
// Display the right cap of the 'button bar'
?>

and i have next warning in each page:

warning: Invalid argument supplied for foreach() in D:\work\market\sites\drupal\themes\alexx\links.tpl.php on line 15.

#9

@KarenS: Thanks for the clarification:-)

#10

Status:needs review» fixed

@KarenS: thanks for the patch!

You are right that your patch does the job. However, it doesn't take the right approach in fixing the problem. The role of the taxonomy wrapper is to provide a compatibility layer between taxonomy and category. This means that functions within the taxonomy wrapper should call their equivalent functions in the category module, and should make any adjustments to the format of passed-in arguments before calling these equivalent functions.

Your patch fixes the problem by bypassing the category_link() function in the category module, and by letting the taxonomy wrapper handle the link generation directly. This goes against the philosophy of a 'wrapper'. What happens when the format of links change in Drupal (as they have/will for HEAD/4.8)? If you're bypassing the category_link() function, and providing duplicate functionality in the taxonomy wrapper's taxonomy_link() function, then there will be 2 functions instead of 1 that need to be updated for the next version of Drupal.

Attached patch fixes the problem, by converting the data to a format that category_link() understands, and hence allowing the taxonomy wrapper to rely on category_link() for doing its job properly. This patch has been tested with category_views: before being applied, no 'taxonomy: terms for [container x]' links appear in category_views listings; and after being applied, the links appear just fine.

Patch committed to HEAD and 4.7 branches of category.

AttachmentSize
taxonomy_wrapper_links.patch 794 bytes

#11

I'm not surprised to find there is a better way to do it. I quit looking once I found something that worked :-)

#12

Status:fixed» active

After installing new cvs version of Category module (with this long-awaited patch), the links to categories (at top of the node) display double time on every node.

#13

You are right. I just downloaded and installed category with the wrapper enabled and there are two links for every category.

#14

Maybe this is causing my issue too.... each item that is catagorized .... shows each catagory twice. (forgive my newbie mis use of terms)....
http://happybabieshappymoms.com/

#15

gerd riesselmann points out in
http://drupal.org/node/83496

that $cid is not initialized in the patch.

(pointing 83496 to this issue)

#16

Priority:normal» critical

#17

Is this a duplicate:

http://drupal.org/node/83490

I don't use category module, but am having the same problem with taxonomy terms for [vocabulary] intermittently - it disappeards from the filters list quite often.

#18

Title:Views: Taxonomy: Terms for [my container] show nothing» taxonomy_link() typo (was: Views: Taxonomy: Terms for [my container] show nothing)
Assigned to:Anonymous» bdragon

Assigning to self. Marking this as the master issue for the taxonomy_link() $cid bug.

Please excuse the deluge.

Thank you for your patience.
--Brandon

#19

The following issues have been marked as duplicates.
http://drupal.org/node/79610
http://drupal.org/node/79890

#20

Status:active» fixed

Fix for the duplicate category labels problem committed to HEAD and 4.7.

#21

Status:fixed» active

Ok in CVS, but in 4.7 problem remain.

#22

i mean duplicate category labels problem

#23

Did you remember to disable and reenable the wrapper?

The actual changed file is in wrappers/taxonomy.module.copyme, it won't reinstall itself....

#24

Status:active» fixed

Look strange. Yes, i think i did it yesterday :) but today, after your post, i rechek and... it works. Sorry.

#25

Status:fixed» closed (fixed)