Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In _webform_submit_cc_email(), rather than doing:
$cc_extra_field_mappings = explode(', ', variable_get('cc_extra_field_mappings'));
foreach ($cc_extra_field_mappings as $key => $value) {
$mapping = explode(':', $value);
$mappings[$mapping[0]] = $mapping[1];
}
How about doing:
$cc_extra_field_mappings = explode(',', variable_get('cc_extra_field_mappings'));
$cc_extra_field_mappings = array_map('trim', $cc_extra_field_mappings);
$mappings = array();
foreach ($cc_extra_field_mappings as $value) {
list($dst, $src) = explode(':', $value, 2);
$mappings[trim($dst)] = trim($src);
}
The way it is written now means that you have to format the list exactly with a comma and single space between each element. In the new way, all we care about is the comma, and extra whitespace will automatically be trimmed off. Also, adding the limit to the second explode will help to make sure that we always get the entire second half.
Comments
Comment #1
attheshow CreditAttribution: attheshow commentedWould you mind creating a patch for your suggested change? The instructions on creating a patch are here: http://drupal.org/patch/create