You are here

function theme_webform_date in Webform 5

Same name and namespace in other branches
  1. 6.3 components/date.inc \theme_webform_date()
  2. 7.4 components/date.inc \theme_webform_date()
  3. 7.3 components/date.inc \theme_webform_date()

Theme a webform date element.

1 theme call to theme_webform_date()
_webform_render_date in components/date.inc
Build a form item array containing all the properties of this component.

File

components/date.inc, line 331

Code

function theme_webform_date($element) {
  $element['#type'] = 'element';

  // Determine the order of day, month, year in the site's chosen date format.
  $format = variable_get('date_format_short', 'm/d/Y - H:i');
  $sort = array();
  $sort['day'] = max(strpos($format, 'd'), strpos($format, 'j'));
  $sort['month'] = max(strpos($format, 'm'), strpos($format, 'M'));
  $sort['year'] = strpos($format, 'Y');
  asort($sort);
  $order = array_keys($sort);

  // Output multi-selector for date.
  $element['#children'] = '';
  foreach ($order as $type) {
    $element['#children'] .= drupal_render($element[$type]);
  }
  $element['#children'] = '<div class="container-inline">' . $element['#children'] . '</div>';
  return theme('form_element', $element, $element['#children']);
}