1 form.inc theme_html_date($variables)

Returns html5 markup for a date input form element.

Related topics

File

core/includes/form.inc, line 3193
Functions for form and batch generation and processing.

Code

function theme_html_date($variables) {
  $element = $variables['element'];
  $attributes = array();
  if (isset($element['#attributes'])) {
    $attributes = $element['#attributes'];
  }
  if (isset($element['#id'])) {
    $attributes['id'] = $element['#id'];
  }
  $attributes['class'][] = 'form-date';
  $attributes['type'] = 'date';
  $attributes['value'] = $element['#value'];
  $attributes['name'] = $element['#name'];

  $output = '<input ' . backdrop_attributes($attributes) . ' />';
  return $output;
}