Closed (fixed)
Project:
Chaos Tool Suite (ctools)
Version:
7.x-1.2
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
1 May 2013 at 15:47 UTC
Updated:
16 May 2013 at 00:50 UTC
I have a field setup as a list (text) that contains key|label pairs. I'm attempting to use these values in a custom content pane with the token substitutions.
I see two tokens per field:
- %node:field_abc
- %node:field-abc
Is there a difference between the two?
Both seem to render the label when I actually want access to the key. Is there a way to accomplish that?
Comments
Comment #1
merlinofchaos commentedThe one with the - is provided by entity_token module and is generally better than the one with the _ which is provided by token.module. In both cases, these are just core Drupal tokens that CTools is re-using.
Use the one with the -; in my experience, the one with the _ is mostly broken. :(
Tokens don't currently have a way to access the key, sadly. Having had to do this, I've written a little bit of code that will let you do this, which I use in some of my projects but isn't publicly available anywhere.
You can use these tokens in CTools with the normal %node:field_foo:raw:value
Unfortunately they won't be selectable or show up in the token list, making them a little less useful for Views.
Comment #2
caschbre commentedThanks merlin for sharing that bit of code. It's very much appreciated.