1

I am having troubles using token replacement for the Time field field type provided by the module Timefield in Rules.

The token pattern [entityform:field-name:value] works just fine (it gets replaced by the raw "offset value" of the field - I'm using this field in an Entityform), but I just can't figure out how to display the formatted value.

I've followed directions in the pattern replacement help text, and tried different combinations of hyphens and low hyphens to no avail: [entityform:field-name:value_formatted], [entityform:field_name:value_formatted] and [entityform:field-name:value-formatted] - none work.

I've already posted a request for support in the Timefield issue queue, but was wondering if anyone here has had a similar issue, and can point me in the right direction? Thank you in advance.

EDIT: After some additional testing, I've discovered that the [entityform:field_name:value_formatted] token DOES work in some situations, such as inside a Rules Component. It does NOT work if the Rule is triggered by the event After saving new content(for nodes) or After saving a new entityform submission (for Entityforms). Obviously this seems to be a bug, but I don't have the time to figure out where this problem happens. Apparently the value token of the field is built right away, but the value_formatted is not readily available when the Rule is triggered right after creating a new entity. Any thoughts?

1 Answer 1

0

Since this problem seems to be a bug, and just in case someone else runs into this issue, there is a workaround you can do within Rules to get the formatted value of the time field. It involves:

  1. Enable the module PHP filter
  2. Use the action Execute custom PHP code to run a PHP snippet that calculates the formatted value using the raw value provided by the token

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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