I just had a thorough look through the taxonomy wrapper because there are things that seem fishy. The first thing I wanted to get out of the way is why tokens [vocab] never returned anything. I think I found the problem pretty much right away.

the function taxonomy_get_vocabulary is converting the object returned from category_get_container into an array. Now I have no idea why that is because the original taxonomy_get_vocabulary from drupal also returns an object instead of an array. I switched it from producing an array to producing an object and voilá tokens [vocab] is working as expected. I expect this to remedy other problems where vocabs are not resolved (views maybe?). So again I only have a surface understanding of things and the array might have been in there for good - but at the moment I can only see things working better rather then worse.

so change line 792-805 from

  $vocabulary['vid'] = $container->cid;
  $vocabulary['name'] = $container->title;
  $vocabulary['description'] = $container->cont_description;
  $vocabulary['help'] = $container->help;
  $vocabulary['relations'] = $container->has_relations;
  $vocabulary['hierarchy'] = $container->hierarchy;
  $vocabulary['multiple'] = $container->multiple;
  $vocabulary['required'] = $container->required;
  $vocabulary['tags'] = $container->tags;
  $vocabulary['module'] = $container->module;
  $vocabulary['weight'] = $container->cont_weight;
  $vocabulary['nodes'] = $container->nodes;

to

  $vocabulary->vid = $container->cid;
  $vocabulary->name = $container->title;
  $vocabulary->description = $container->cont_description;
  $vocabulary->help = $container->help;
  $vocabulary->relations = $container->has_relations;
  $vocabulary->hierarchy = $container->hierarchy;
  $vocabulary->multiple = $container->multiple;
  $vocabulary->required = $container->required;
  $vocabulary->tags = $container->tags;
  $vocabulary->module = $container->module;
  $vocabulary->weight = $container->cont_weight;
  $vocabulary->nodes = $container->nodes;

A coding gods input would be welcomed.

Comments

falk_g’s picture

ugh and delete


  $vocabulary = array();

in line 792 of course.

falk_g’s picture

Status: Needs work » Needs review
JirkaRybka’s picture

Status: Needs review » Fixed

Marked #176276: taxonomy_get_vocabulary function in taxonomy wrapper module returns array but it must return same information as object as duplicate.

As of 6.x, the function doesn't even exist. There's taxonomy_vocabulary_load(), which is more or less verbatim from core, having no such problem.

As of 5.x, the messages are seemingly mixed: In CVS there seems to be currently two 5.x branches, where 'DRUPAL-5' have this fixed in latest revision of the file, and 'DRUPAL-5--2' doesn't. The fix didn't make it to any stable release. But the available 5.x-1.x-dev tarball does have the fix - so that's at least one release fixed (although just a development snapshot), and a proof that the fix got committed.

So I believe this is Fixed one... Whether new releases are rolled after such fixes, that's a differernt question (and frankly, I had problems with that regarding several Drupal projects), but it doesn't stop issues here becoming 'fixed' after commit ;-)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.