In case you want to use token replacements to store data, not to display it to user, you would prefer to to store it as is rather in formatted form. But right now we have no ability to choose does replacements should be formatted or no, they always formatted.

Comments

rosk0’s picture

Status: Active » Needs review
StatusFileSize
new1.94 KB

Initial patch.

valthebald’s picture

Status: Needs review » Reviewed & tested by the community

Tested patch manually with CRM core donation profile.
Before patch: donation form fails with white screen.
After patch: donation form submits correctly.

fago’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Closed (won't fix)

In case you want to use token replacements to store data...

Then you are using the wrong system - token system is for formatting data for text replacements. If you want data values, uses the metadata wrapper.

Besides that, this introduces an undocumented option switch which is not good either.

rosk0’s picture

Status: Closed (won't fix) » Active

@fago: Probably I described our use case with wrong words. We are using tokens in CRM Core Profile in this way: user creates a form with UI, lets say for event registration, this form when get submitted creates multiple entities: contact to store data about who is registered, activity - stores info about registration to event. In CRM Core Profile form builder we allow user to use tokens to specify values that should be set automatically upon submission. This values can include node id of the event user registered to, amount user paid for registration, etc. We can use wrapper to get real values, it's not a problem, the problem is that we don't know what field of what entity the user will decide to use and where(in what field). And for me the token system is working great for this purpose. Without this patch we can't use CRM Core Profile forms to collect integer data values greater then 1000 via token system and I want to ask you to help me figure out workaround for this problem.

rosk0’s picture

Assigned: rosk0 » Unassigned
rosk0’s picture

StatusFileSize
new1.96 KB

Reroll against HEAD.
@fago: Is there any chance that you will think about solution to our problem?

socialnicheguru’s picture

Status: Active » Needs review
roborew’s picture

I ran into a similar issue. I needed to use the Key value in a field select list, but found the Entity Token module re-formats the token using the label value, if its available.

I wrote a simple module to tackle the problem which I believe would solve the feature you are looking for above. Please take a look and have a test.

https://www.drupal.org/sandbox/roboco/2709617

chris matthews’s picture

Status: Needs review » Closed (won't fix)

The 4 year old patch in #6 to entity_token.tokens.inc applied cleanly to the latest entity 7.x-1.x-dev, but changing the status back to Won't fix per Fago's comment in #3 and workaround here: https://www.drupal.org/sandbox/roboco/2709617