Anyone have any ideas on how I could reference a custom D7 field and use it as a token. The field in question is actually a term reference (autocomplete field). I know how to create tokens, just finding it difficult to reference Drupal 7 fields. I plan on using it to create a custom path, with pathauto.
node module uses
case 'body':
case 'summary':
if (!empty($node->body)) {
$item = $node->body[$node->language][0];
$column = ($name == 'body') ? 'value' : 'summary';
$instance = field_info_instance('node', 'body', $node->type);
$replacements[$original] = $sanitize ? _text_sanitize($instance, $node->language, $item, $column) : $item[$column];
}
Could i not do the same with a custom field?
Comments
Comment #1
vglocus commentedThere should be a token available.
If you have a taxonomy field named field_example there should be a token [node:field-example:name] (the term name).
Look under the Node tab.
Best of luck.
Comment #2
davidd07 commentedOk im looking under path auto settings /patterns, and there definately no field_type tokens. Just Drupals default fields. I always thought for custom fields you need to create your own token?
Comment #3
NickWebman commenteddavidd07: I'm trying to do the exact same thing. Fields are not showing for me as Tokens in Pathauto... and it sure would help if they did.
Comment #4
NickWebman commentedComment #5
NickWebman commentedhttp://drupal.org/node/691078
See patch in comment #143
It works. Seems like it should be committed.
Comment #6
dave reidThis is a duplicate of #691078: Field tokens
Comment #7
Sborsody commented@#1 vglocus,
Entity API and Entity Tokens modules provide that too. Check if you are using them.
Comment #8
rogical commentedI think this is not a duplicate of #691078: Field tokens
The core fields do have tokens, but external custom fields don't.
Please see the attachment.
the field field_example, field_recruit, field_mail doesn't show in token.
Comment #10
dave reidYes, this is in fact a duplicate of #691078: Field tokens and it would be up to the modules providing those field types to also provide tokens once 691078 lands.
Comment #11
janvdp commentedI use this comment to subscribe...