Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 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;
  }
}
share|improve this answer
    
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 Mar 28 '12 at 20:26
    
hmm -- maybe here you'll find something .. drupal.org/node/627726 –  rémy Mar 29 '12 at 16:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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