You are here

function theme_fel_webform_element in Form element layout 7

Replacement for theme_webform_element().

File

modules/fel_webform/fel_webform.module, line 30
Webform support for Form element layout.

Code

function theme_fel_webform_element($variables) {
  $element = $variables['element'];
  $output = '<div ' . drupal_attributes($element['#wrapper_attributes']) . '>' . "\n";
  $prefix = isset($element['#field_prefix']) ? '<span class="field-prefix">' . webform_filter_xss($element['#field_prefix']) . '</span> ' : '';
  $suffix = isset($element['#field_suffix']) ? ' <span class="field-suffix">' . webform_filter_xss($element['#field_suffix']) . '</span>' : '';

  // managed_file uses a different id, make sure the label points to the correct
  // id.
  if (isset($element['#type']) && $element['#type'] === 'managed_file') {
    if (!empty($variables['element']['#id'])) {
      $variables['element']['#id'] .= '-upload';
    }
  }
  $element_parts = array(
    'children' => $prefix . $element['#children'] . $suffix,
  );
  if ($element['#title_display'] != 'none' and $element['#title_display'] != 'attribute') {
    $element_parts['title'] = theme('fel_form_element_label', $variables);
  }
  if (!empty($element['#description'])) {
    $element_parts['description'] = theme('fel_form_element_description', $variables) . "\n";
  }
  fel_order_output($element, $element_parts);
  $output .= implode(' ', $element_parts);
  $output .= "</div>\n";
  return $output;
}