0

I'm trying to define a Display Suite Code Field which would be responsible for converting a list item key (selected in a dropdown on admin side) into an image on the output side. The field simply assumes the list keys:

series1|Series 1 Name
series2|Series 2 Name

correspond to the images names and the tokenized field definition is as in:

<img class="product-series" src="/path/to/image/[node:field-product:field-series].png"/>

However what I got after replacement is the label ("Series 1 Name"), instead of the key. Is there a way to force the key replacement? (Yes I know I could drop the Label part, but this would not be admin friendly)

  • Oh, gosh, what an oldie. This has been solved by writing a custom formatter. – Artur Nov 11 '12 at 19:38
0

Enable the "Token" view mode and select "Key" as field formatter for the "Series" field.

  • Hello and welcome. Could you please expand your answer a bit? Please write why action mentioned should help and why, in your opinion, OPs problems are happening. – Mołot Oct 18 '13 at 23:46
0

Way old, I know but I was fighting with a similar issue (though I wanted keys and was getting labels) and after much fighting got it to work so I figured I would share. I went to "Manage Display Settings" for the content type and enabled "Tokens" under "Custom Display Settings." Then selected "Tokens" under the "Manage Displays" heading and changed my select list's format from "Default" to "Key". Using the Devel module I could see then that I had 2 available Tokens one was in the format [node:field-example-field-one] and the other in the format [node:field_example_field_one]. The one with dashes contained my Label and the one with underscore contained my Key.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.