You are here

function theme_webform_email_component_mapping in Webform 7.4

Theme the presentation of select list option to e-mail address mappings.

1 theme call to theme_webform_email_component_mapping()
webform_email_edit_form in includes/webform.emails.inc
Form for configuring an e-mail setting and template.

File

includes/webform.emails.inc, line 470
Provides interface and database handling for e-mail settings of a webform.

Code

function theme_webform_email_component_mapping($variables) {
  $element = $variables['element'];
  $header = array(
    t('Option'),
    t('E-mail address'),
  );
  $rows = array();
  foreach (element_children($element) as $key) {
    $element[$key]['#theme_wrappers'] = array();
    $row = array();
    $row[] = array(
      'data' => theme('form_element_label', array(
        'element' => $element[$key],
      )),
      'class' => array(
        'webform-email-option',
      ),
    );
    $row[] = drupal_render($element[$key]);
    $rows[] = $row;
  }
  $empty = t('This component has no options defined yet.');
  $table = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'sticky' => FALSE,
    'empty' => $empty,
  ));
  $description = t('The selected component %name has multiple options. You may enter an e-mail address for each choice.', array(
    '%name' => $element['#title'],
  ));
  if ($element['#webform_allow_empty']) {
    $description .= ' ' . t('When that choice is selected, an e-mail will be sent to the corresponding address. If a field is left blank, no e-mail will be sent for that option.');
  }
  else {
    $description .= ' ' . t('When that choice is selected, an e-mail will be sent from the corresponding address.');
  }
  $wrapper_element = array(
    '#title' => t('Component e-mail options'),
    '#children' => $table,
    '#description' => $description,
    '#theme_wrappers' => array(
      'form_element',
    ),
    '#id' => NULL,
  );
  return render($wrapper_element);
}