You are here

function theme_webform_mail_settings_form in Webform 6.2

Same name and namespace in other branches
  1. 5.2 webform.module \theme_webform_mail_settings_form()

Theme the Webform mail settings section of the node form.

1 theme call to theme_webform_mail_settings_form()
webform_form in ./webform.module
Implementation of hook_form(). Creates the standard form for editing or creating a webform.

File

./webform.module, line 929

Code

function theme_webform_mail_settings_form($form) {
  drupal_add_js(drupal_get_path('module', 'webform') . '/webform.js');

  // Loop through fields, rendering them into radio button options.
  foreach (array(
    'from_name',
    'from_address',
    'subject',
  ) as $field) {
    foreach (array(
      'custom' => t('Custom'),
      'component' => t('Component'),
    ) as $option => $title) {
      $form['email_' . $field . '_' . $option]['#attributes']['class'] = 'webform-set-active';
      $form['email_' . $field . '_option'][$option]['#title'] = $title . ': ' . drupal_render($form['email_' . $field . '_' . $option]);
    }

    // For spacing consitency, every option is wrapped in container-inline.
    foreach (element_children($form['email_' . $field . '_option']) as $option) {
      $form['email_' . $field . '_option'][$option]['#prefix'] = '<div class="container-inline">';
      $form['email_' . $field . '_option'][$option]['#suffix'] = '</div>';
    }

    // Wrap the default option in a placeholder tag..
    if (isset($form['email_' . $field . '_option']['#options']['default'])) {
      $form['email_' . $field . '_option']['default']['#title'] = t('Default') . ': ' . theme('placeholder', $form['email_' . $field . '_option']['default']['#title']);
    }
  }
  return drupal_render($form);
}