Closed (fixed)
Project:
Pathauto
Version:
5.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
27 Jul 2007 at 15:34 UTC
Updated:
25 Aug 2007 at 14:03 UTC
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
Comment #1
gregglesInteresting problem. I just confirmed that they are not available - now I need to figure out why not.
Comment #2
gregglesSo, 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.
Comment #3
xjmAre 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.
Comment #4
xjmAhh, 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.
Comment #5
gregglesUsing 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);
}
}
Comment #6
(not verified) commented