You are here

function theme_webform_mail_select in Webform 6.2

Same name and namespace in other branches
  1. 5.2 components/select.inc \theme_webform_mail_select()
  2. 5 components/select.inc \theme_webform_mail_select()

Format the output of emailed data for this component.

Parameters

$data: A string or array of the submitted data.

$component: An array of information describing the component, directly correlating to the webform_component database schema.

Return value

Textual output to be included in the email.

File

components/select.inc, line 294
Webform module multiple select component.

Code

function theme_webform_mail_select($data, $component) {

  // Convert submitted 'safe' values to un-edited, original form.
  $options = _webform_select_options($component['extra']['items'], TRUE);

  // Generate the output.
  $output = '';
  if ($component['extra']['multiple']) {
    $output .= $component['name'] . ":\n";
    foreach ((array) $data as $value) {
      if ($value) {
        if ($options[$value]) {
          $output .= '    - ' . $options[$value] . "\n";
        }
      }
    }
  }
  else {
    if ($data !== '' && $options[$data]) {
      $output .= $component['name'] . ": " . $options[$data] . "\n";
    }
  }
  return $output;
}