1 form.inc theme_html_time($variables)

Returns html5 markup for a time input form element.

Related topics

File

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

Code

function theme_html_time($variables) {
  $element = $variables['element'];
  $attributes = array();
  if (isset($element['#attributes'])) {
    $attributes = $element['#attributes'];
  }
  if (isset($element['#id'])) {
    $attributes['id'] = $element['#id'];
  }
  $attributes['class'][] = 'form-time';
  $attributes['type'] = 'time';
  $attributes['value'] = $element['#value'];
  $attributes['name'] = $element['#name'];
  $attributes['step'] = 1;
  if (isset($element['#attributes']['step'])) {
    // Allow to set cardinality to "minute".
    if ($element['#attributes']['step'] == 60) {
      $attributes['step'] = 60;
    }
  }

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