I am creating a custom module webform3rdparty integration to icontact .Using my module create an extra field in weform field to add icontact field(mapping purpose).I want to use token replacement patterns in my field.How to call these replacepatterns in my custom module.

1 Answer 1


I think you need these hooks:

  1. hook_token_info() - this hook will allow you to define empty placeholders. Define a few placeholders which you want to make available to the webform.
  2. hook_tokens() - corresponding to the plkaceholders you have defined, pass in appropriate stuff and define a replacement pattern for each placeholders you have defined in your earlier hook_implementation.
  3. Finally, while rendering user submitted value, apply token_replace() function to replace the placeholders entered by user with appropriate values.


Got you. Have a look at this function _webform_filter_values(). This funciton is responsible for replacement of webform tokens. you can use this funciton in your code, pass in the stuffs you want to replace and the node and submiccions object and have the value replaced.

It will be impossible for me to give you exact direction, as i am not familiar with what you are doing. But i can give you a general idea. Token replacement often happens at the output stage. So it is more concerned with output. So mostly, you need to apply this to your code which displays/prints/uses the webform submission result of your field.

Say you create a webform field. I as an end user, enter a string to it which contains this: %post[key]. Now your submit handler code will need to use the said function. When you pass the input i entered through that function, my %post[key] is replaced by appropriate value.

  • I want to call replacepatterns used in webforms in my site.ie,I would like to be able to use tokens %post[key]
    – Aparna pc
    Oct 9, 2013 at 8:09
  • Updated my answer. please have a look.
    – Neo
    Oct 9, 2013 at 8:30
  • Thank you neo for your detailed reply.But still i am confused how to implement for that particular field created by my module.
    – Aparna pc
    Oct 9, 2013 at 9:23
  • I will not be able to provide you with detailed code, but just updated my answer as the last shot to help you grab the concept. hope that helps.
    – Neo
    Oct 9, 2013 at 9:33

Your Answer

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

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