diff --git a/sites/all/modules/webform/webform.module b/sites/all/modules/webform/webform.module index 6ff3c85..570732b 100644 --- a/sites/all/modules/webform/webform.module +++ b/sites/all/modules/webform/webform.module @@ -2956,8 +2956,15 @@ function _webform_filter_values($string, $node = NULL, $submission = NULL, $emai $display_element['#id'] = drupal_html_id('edit-' . implode('-', $display_element['#parents'])); } $replacements['email'][$format]['%email[' . $form_key . ']'] = render($display_element); + if (isset($display_element['#options'])) { + $display_element_email_safe_key = array_diff_key($display_element, array('#options' => '')) + array('#options' => array_flip($display_element['#options'])); + $replacements['email'][$format]['%email_safe_key[' . $form_key . ']'] = render($display_element_email_safe_key); + } $display_element['#theme_wrappers'] = array(); // Remove label and wrappers. $replacements['email'][$format]['%value[' . $form_key . ']'] = render($display_element); + if (isset($display_element['#options'])) { + $replacements['email'][$format]['%safe_key[' . $form_key . ']'] = check_plain(implode(',', array_intersect(array_keys($display_element['#options']), $value['value']))); + } } // Provide blanks for components in the webform but not in the submission. @@ -2966,7 +2973,9 @@ function _webform_filter_values($string, $node = NULL, $submission = NULL, $emai $parents = webform_component_parent_keys($node, $component); $form_key = implode('][', $parents); $replacements['email'][$format]['%email[' . $form_key . ']'] = ''; + $replacements['email'][$format]['%email_safe_key[' . $form_key . ']'] = ''; $replacements['email'][$format]['%value[' . $form_key . ']'] = ''; + $replacements['email'][$format]['%safe_key[' . $form_key . ']'] = ''; } // Submission edit URL. @@ -3223,6 +3232,7 @@ function theme_webform_token_help($variables) { 'tokens' => array( '%email_values' => t('All included components in a hierarchical structure.'), '%email[' . t('key') . '] ' => t('A formatted value and field label. Elements may be accessed such as %email[fieldset_a][key_b]. Do not include quotes.'), + '%email_safe_key[' . t('key') . '] ' => t('A formatted safe_key for a select options field. Elements may be accessed such as %email_safe_key[fieldset_a][key_b]. Do not include quotes.'), '%submission_url' => t('The URL for viewing the completed submission.'), ), ); @@ -3232,6 +3242,7 @@ function theme_webform_token_help($variables) { 'tokens' => array( '%sid' => t('The unique submission ID.'), '%value[key]' => t('A value without additional formatting. Elements may be accessed such as %value[fieldset_a][key_b]. Do not include quotes.'), + '%safe_key[key]' => t('The safe_key for a select options field. Elements may be accessed such as %safe_key[fieldset_a][key_b]. Do not include quotes. Multiple values will be concatenated with commas.'), ), ); }