I have a cck field that I need to pull the raw value and not the label.

Any idea how I would go about doing this?

Comments

itangalo’s picture

That would require a change in this module. It wouldn't be that difficult to do, per se, but it would start bloating the available tokens in a way that I don't really want to do. Instead I would like a way to set raw/formatted value for each merge style that you define.

This is related to #974374: provide lists of Term-IDs.

If you like the idea, this will be the main issue for discussing and executing this idea.

jday’s picture

I need to get an array of a multiple value email field to print out like this:
email1@gmail.com, email2@gmail.com, email3@gmail.com

currently the token for [node:field_email-default-array-view] prints out like this:
; a href= "mailto:email1@gmail.com"; a href= "mailto:email2@gmail.com"

maybe this is an issue for the cck email module and its display values...? ideas anyone?

jday’s picture

I found a patch for plain text email display here:
http://drupal.org/node/754554

but the only token array options are still the formatted "a href=emailvalue...." array

itangalo’s picture

Status: Active » Fixed

Hi

Sorry for responding so late – it seems to me that you actually can do this with the current functionality in Array Tokens. Try configuring your token with no prefix/suffix, and "; " as infix. Then you should be able to get all e-mail addresses like so:

<a href="mailto:[node:field_email-custom-array-view]">E-mail all</a>

Correct me if I'm wrong – closing this issue for now.

jday’s picture

I need all html tags stripped because the array of emails would go into a Rules email "to" field. I ended up switching to multiple single fields rather than a multiple value field. I could not find where the emails were getting formatted like that.

itangalo’s picture

Title: -raw » Raw token value for e-mail fields
Category: support » feature
Status: Fixed » Active

Ah, now I see. Thanks for clarifying.

The only fields available in "raw" format right now are text fields, reference fields and text fields (I think), plus tags – the ones in core + CCK. Doing this for e-mail fields wouldn't be *that* difficult, but it will be kind of difficult to find the time to actually do it. :-(

I'm gonna mark this as a feature request and change the title, to make it easier for me to remember the issue.
The order I take care of feature requests will be determined by the discussions at each issue, plus my unpredicable mood for the day. Eh. Patches of course welcome.

Thanks for the idea for a new useful feature.

peter törnstrand’s picture

StatusFileSize
new4.79 KB

I have a similar use case where I wan't to send e-mails to multiple users based on a multiple user reference field. I created a quick patch as proof of concept.
Please note that this patch was made very quickly and I'm sure there are lots of room for improvements. It does however work.

itangalo’s picture

Thanks for the patch! Will have a look at it later.

jgoodwill01’s picture

+1 I can't seem to get this to work. CCK Email fields are now available in -raw format. How can I get a raw array? I need this for a Rule as well.

jgoodwill01’s picture

Actually I was able to fix this by changing the Display Token settings to Plain Text.