Skip to main content
more info about what I've tried.
Source Link
UltraBob
  • 1.3k
  • 9
  • 37

I need to get the key of the key|value pair from a text list field in a token.

Say the field configuration shows the following options:

no|No Way Jose!
yes|Why yes, that'd do nicely!

and the field is named field_doc_textlist

the token [node:field_doc_textlist] is returning a value like 'No Way Jose!' when what I want is 'no'. Is there a way to get that from tokens. I'm using this in the filefield paths module if that matters.

I saw other similar answers here, with no real answers, but I've tried [node:field_doc_textlist:key] [node:field-doc-textlist] [node:field_doc_textlist:machine_name] [node:field_doc_textlist:machine-name] all to no avail

Some additional information: All of the above result in an error similar to

The File path is using the following invalid tokens: [node:field-doc-type-book].

A lot of the information I've found suggests using the hyphenated version of the token name instead of the underscore version, but that seems not to work at all.

I need to get the key of the key|value pair from a text list field in a token.

Say the field configuration shows the following options:

no|No Way Jose!
yes|Why yes, that'd do nicely!

and the field is named field_doc_textlist

the token [node:field_doc_textlist] is returning a value like 'No Way Jose!' when what I want is 'no'. Is there a way to get that from tokens. I'm using this in the filefield paths module if that matters.

I saw other similar answers here, with no real answers, but I've tried [node:field_doc_textlist:key] [node:field-doc-textlist] [node:field_doc_textlist:machine_name] [node:field_doc_textlist:machine-name] all to no avail

I need to get the key of the key|value pair from a text list field in a token.

Say the field configuration shows the following options:

no|No Way Jose!
yes|Why yes, that'd do nicely!

and the field is named field_doc_textlist

the token [node:field_doc_textlist] is returning a value like 'No Way Jose!' when what I want is 'no'. Is there a way to get that from tokens. I'm using this in the filefield paths module if that matters.

I saw other similar answers here, with no real answers, but I've tried [node:field_doc_textlist:key] [node:field-doc-textlist] [node:field_doc_textlist:machine_name] [node:field_doc_textlist:machine-name] all to no avail

Some additional information: All of the above result in an error similar to

The File path is using the following invalid tokens: [node:field-doc-type-book].

A lot of the information I've found suggests using the hyphenated version of the token name instead of the underscore version, but that seems not to work at all.

Source Link
UltraBob
  • 1.3k
  • 9
  • 37

Is there a token for the key of a text list?

I need to get the key of the key|value pair from a text list field in a token.

Say the field configuration shows the following options:

no|No Way Jose!
yes|Why yes, that'd do nicely!

and the field is named field_doc_textlist

the token [node:field_doc_textlist] is returning a value like 'No Way Jose!' when what I want is 'no'. Is there a way to get that from tokens. I'm using this in the filefield paths module if that matters.

I saw other similar answers here, with no real answers, but I've tried [node:field_doc_textlist:key] [node:field-doc-textlist] [node:field_doc_textlist:machine_name] [node:field_doc_textlist:machine-name] all to no avail