Contributions API

theme_webform_mail_settings_form

Definition

theme_webform_mail_settings_form($form)
contributions/webform/webform.module, line 823

Description

Theme the Webform mail settings section of the node form.

Code

<?php
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);
}
?>