cck taxonomy ssu Tokens not working with pathauto and auto_nodetitle

doc2@drupalfr.org - March 18, 2008 - 16:44
Project:CCK Taxonomy Super Select Ultra
Version:5.x-1.1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Hello there,

I have a "location" voc which is
- non obligatory
- single hierarchy
- multiple
- freetagging

For each nodetype of a "document" group (images, videos...) I have a specific cck_taxonomy_ssu "location" field.

    The reason for that is the need for different field labels and the need for independency and clear machine_name reference of the tables concerned in case of nodedata exports.

But the tokens used in both pathauto or auto_nodetitle won't work and I'll either get the token name (auto_nodetitle) or a white space (pathauto) instead of it. The tokens (translated) look like this: [field_doc_av_location-raw] and [field_doc_av_location-formatted]. Both won't work.

Would you have an idea of what's wrong?

#1

doc2@drupalfr.org - March 18, 2008 - 18:50
    Child related issue: To get a correct nodetitle and path, I needed to use the [term] token and therefore turn my vocabulary back on as a workaround on my "document" nodetypes. This led me to get a minor but annoying "duplicate entry" error, as well as two places to tag my nodes, which makes it confusing for my editors. Indeed, I have the same problem on another vocab which is obligatory and therefore the editors cannot just ommit to tag the node in the category fieldset.

    Child issue reference #235907: "Duplicate entry" error when same vocabulary & ccktssu field are enabled (token related)

#2

rconstantine - March 20, 2008 - 04:51

I'll take a look when I get a chance, but I seem to recall that someone else wrote the token functions for this module. That is, if there are token functions - I honestly can't remember and I'm not in front of the code right now. So first things first - verify that there are two token functions in the module. Feel free to copy and paste them here as I am often away from my development machine and we can look at them here instead.

#3

doc2@drupalfr.org - April 8, 2008 - 08:48

Here is the code, from line 1131 to 1163:

//-----------------------------------------Token Module Integration-------------------------------------

/**
* Implementation of hook_token_list from the token module.
*
* See http://drupal.org/project/token for more details.
*/
function cck_taxonomy_ssu_token_list($type = 'all') {
  if ($type == 'field' || $type == 'all') {
    $tokens = array();

    $tokens['cck_taxonomy_ssu']['raw']       = t("Raw term value.");
    $tokens['cck_taxonomy_ssu']['formatted'] = t("Formatted term value.");

    return $tokens;
  }
} // function cck_taxonomy_ssu_token_list()

/**
* Implementation of hook_token_values from the token module.
*
* See http://drupal.org/project/token for more details.
*/
function cck_taxonomy_ssu_token_values($type, $object = NULL) {
  if ($type == 'field') {
    $item = array_shift($object);

    $tokens['raw']       = $item['tid'];
    $tokens['formatted'] = $item['view'];

    return $tokens;
  }
} // function cck_taxonomy_ssu_token_values()

Anyone on this?

AttachmentSize
cck_taxonomy_ssu.module.txt 53.12 KB

#4

rconstantine - April 8, 2008 - 00:43

My first impression is that something doesn't look right, but I don't know what. I have only written a couple of pairs of these functions for other modules of mine. For example, the cck_fullname module wherein I export each name part as a separate token. At least, that's what I recall.

So I haven't worked through the code here to know what is happening, but maybe it isn't doing what it ought to. If you can find a token code guru to take a look, please do. I don't presently have the time.

#5

greggles - April 8, 2008 - 12:22

The behavior you see (token doesn't get replaced or gets replaced with white space) means that the value given back for this token by hook_token_values (in this case ck_taxonomy_ssu_token_values) is not parsing the data correctly and is either not setting that token (in the case of ANT) or is setting it to white space (in the case of Pathauto).

I don't know anything about ccktssu nor about parsing it's data so I can't offer guidance on how to fix this issue beyond what I just stated.

#6

DanielTheViking - April 20, 2008 - 20:59

Subscribing.

#7

Summit - November 26, 2008 - 09:18

Subscribing, any update on this please?
greetings, Martijn

 
 

Drupal is a registered trademark of Dries Buytaert.