You are here

function theme_webform_email in Webform 7.3

Same name and namespace in other branches
  1. 6.3 components/email.inc \theme_webform_email()
  2. 7.4 components/email.inc \theme_webform_email()

Theme function to render an email component.

1 theme call to theme_webform_email()
webform_element_info in ./webform.module
Implements hook_element_info().

File

components/email.inc, line 163
Webform module email component.

Code

function theme_webform_email($variables) {
  $element = $variables['element'];

  // This IF statement is mostly in place to allow our tests to set type="text"
  // because SimpleTest does not support type="email".
  if (!isset($element['#attributes']['type'])) {
    $element['#attributes']['type'] = 'email';
  }

  // Convert properties to attributes on the element if set.
  foreach (array(
    'id',
    'name',
    'value',
    'size',
  ) as $property) {
    if (isset($element['#' . $property]) && $element['#' . $property] !== '') {
      $element['#attributes'][$property] = $element['#' . $property];
    }
  }
  _form_set_class($element, array(
    'form-text',
    'form-email',
  ));
  return '<input' . drupal_attributes($element['#attributes']) . ' />';
}