Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Is there a way to display the code option label in a token, instead of the stored option value (which is the option key in the key => label pair)?
Example:
function mymodule_get_status_codes() {
return array(
'open' => 'Still open!',
'closed' => 'Closed',
);
}
[node:field_status] token returns 'open'. But I would need to use the 'Still open!' option label, in an e-mail template in my use case.
Comments
Comment #1
PasqualleCodes module does not have any special token support, it should work same as "list (text)" field.
try [node:field-fieldname:value], not sure if it works..
http://drupal.org/node/691078?page=1
Comment #2
PasqualleThis is how to switch node tokens to not show code but label:
1. go to you content type display settings (admin/structure/types/manage/page/display for "page" node type)
2. Enable custom view mode "Tokens"
3. go to "Tokens" view mode and on your code field set format to "Default" (or "Div with class")
now your [node:field_status] token will return the code label (in you example as 'Still open!')
Comment #3
PasqualleThis should have a documentation..