diff --git a/includes/webform.emails.inc b/includes/webform.emails.inc
index 619b602..b56badc 100644
--- a/includes/webform.emails.inc
+++ b/includes/webform.emails.inc
@@ -302,6 +302,7 @@
'#rows' => max(10, min(20, count(explode("\n", $template)))),
'#default_value' => $template,
'#wysiwyg' => webform_email_html_capable() ? NULL : FALSE,
+ '#description' => theme('webform_token_help', array('groups' => array('node', 'submission'))),
);
$form['template']['html'] = array(
@@ -316,10 +317,6 @@
'#title' => t('Include files as attachments'),
'#default_value' => $email['attachments'],
'#access' => webform_email_html_capable(),
- );
-
- $form['template']['tokens'] = array(
- '#markup' => theme('webform_token_help', array('groups' => array('node', 'submission'))),
);
$form['template']['components'] = array(
diff --git a/includes/webform.pages.inc b/includes/webform.pages.inc
index f7eefce..20960ce 100644
--- a/includes/webform.pages.inc
+++ b/includes/webform.pages.inc
@@ -36,7 +36,7 @@
$form['submission']['confirmation'] = array(
'#type' => 'text_format',
'#title' => t('Confirmation message'),
- '#description' => t('Message to be shown upon successful submission. If the redirection location is set to Confirmation page it will be shown on its own page, otherwise this displays as a message. Supports Webform token replacements.'),
+ '#description' => t('Message to be shown upon successful submission. If the redirection location is set to Confirmation page it will be shown on its own page, otherwise this displays as a message. Supports Webform token replacements.') . ' ' . theme('webform_token_help', array('groups' => array('node', 'submission'))),
'#default_value' => $node->webform['confirmation'],
'#cols' => 40,
'#rows' => 10,
@@ -64,10 +64,7 @@
'#type' => 'item',
'#title' => t('Redirection location'),
'#theme' => 'webform_advanced_redirection_form',
- '#description' => t('Choose where to redirect the user upon successful submission.') . ' ' . t('The Custom URL option supports Webform token replacements.'),
- );
- $form['submission']['tokens'] = array(
- '#markup' => theme('webform_token_help', array('groups' => array('node', 'submission'))),
+ '#description' => t('Choose where to redirect the user upon successful submission.') . ' ' . t('The Custom URL option supports Webform token replacements.') . ' ' . theme('webform_token_help', array('groups' => array('node', 'submission'))),
);
$form['submission']['redirection']['redirect']= array(
'#type' => 'radios',
diff --git a/webform.module b/webform.module
index 95b0abc..7e3edd4 100644
--- a/webform.module
+++ b/webform.module
@@ -3368,6 +3368,13 @@
function theme_webform_token_help($variables) {
$groups = $variables['groups'];
+ // If token supports dialogs, display simply as a link.
+ module_load_include('inc', 'token', 'token.pages');
+ if (function_exists('token_page_output_tree')) {
+ return theme('token_tree', array('token_types' => $groups, 'dialog' => TRUE));
+ }
+
+ // If dialogs are not supported, show as a fieldset.
$fieldset = array(
'#title' => t('Token values'),
'#type' => 'fieldset',