4

I have written a custom module which defines some tokens. These tokens are used e.g. in Wysiwyg editor this way: [mytype:closing_date] (I have token_filter module)

Is it posible to make these tokens available also in the Webform module, and specifically in the confirmation e-mail that is sent after filling the form?

I tried %mytype[closing_date] but didn't work.

1 Answer 1

1

use also the token module, you'll find instructions in its documentation.

basically, you'll need to implement these two hooks:

function my_user_token_values($type, $object = NULL, $options = array()) {
  if ($type == 'user') {
    $user = $object;
    $tokens['name']      = $user->name;
    $tokens['mail']      = $user->mail;
    return $tokens;
  }
}

and

function my_user_token_list($type = 'all') {
  if ($type == 'user' || $type == 'all') {
    $tokens['user']['name']      = t("The user's name");
    $tokens['user']['mail']      = t("The user's email address");
    return $tokens;
  }
}
2
  • I have already implemented these hooks in my custom module which defines tokens (the hooks are named differently in D7 than in D6). But how to use them in the Webform e-mail confirmation?
    – camcam
    Commented Mar 28, 2012 at 20:26
  • hmm -- maybe here you'll find something .. drupal.org/node/627726
    – rémy
    Commented Mar 29, 2012 at 16:34

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.