CCK fields are not listed as available tokens for nodes at admin/settings/pathauto. They were available in previous versions of pathauto.

I don't think this is an issue related to CCK or the token module itself, because another token-dependent module (auto_nodetitles) has CCK fields available as tokens.

I have the 5.x-2.x-dev version of pathauto and 5.x-1.x-dev version of token.

Comments

greggles’s picture

Interesting problem. I just confirmed that they are not available - now I need to figure out why not.

greggles’s picture

So, the data structure that token returns from token_get_list is not as pathauto expects it. The patterns should work, but the help text doesn't. I'm planning to code around this in pathauto for now, and suggest fixes for it in a 2.x version of token for the future.

xjm’s picture

Are you saying the CCK tokens should work in patterns in the current build despite that they're not listed? I tried mypath/[field_my_fieldname] (actually just pasted in the patterns from when I had the release version installed) and they were just treated as strings. I get URLs like

http://mysite.com/mypath/%5Bfield_my_fieldname%5D
http://mysite.com/mypath/%5Bfield_my_fieldname%5D-0
http://mysite.com/mypath/%5Bfield_my_fieldname%5D-507

Thanks for looking into this so quickly.

xjm’s picture

Ahh, I figured it out--instead of [field_my_fieldname] I have to use [field_my_fieldname-title]. Token's tokens are slightly different from the old pathauto ones.

greggles’s picture

Title: CCK fields not available as tokens in 5.x-2.x-dev » book and CCK token help not showing
Assigned: Unassigned » greggles
Status: Active » Fixed

Using following completely inflexible hack to get this to work - for the next version of token we should break the array structure and nest these more appropriately...

// TODO: we may need to translate these?
$pattern_types = array('node', 'book', 'CCK text', 'CCK node reference', 'CCK number', 'CCK user reference', 'CCK link');
foreach ($pattern_types as $pattern_type) {
foreach ($patterns[$pattern_type] as $pattern => $description) {
$settings['placeholders'][t('['. $pattern .']')] = t($description);
}
}

Anonymous’s picture

Status: Fixed » Closed (fixed)