function theme_date

Returns HTML for an #date form element.

Supports HTML5 types of 'date', 'datetime', 'datetime-local', and 'time'. Falls back to a plain textfield. Used as a sub-element by the datetime element type.

Parameters

array $variables: An associative array containing:

  • element: An associative array containing the properties of the element. Properties used: #title, #value, #options, #description, #required, #attributes, #id, #name, #type, #min, #max, #step, #value, #size.

Related topics

1 theme call to theme_date()
system_element_info in drupal/core/modules/system/system.module
Implements hook_element_info().

File

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

Code

function theme_date($variables) {
  $element = $variables['element'];
  if (empty($element['attribute']['type'])) {
    $element['attribute']['type'] = 'date';
  }
  element_set_attributes($element, array(
    'id',
    'name',
    'type',
    'min',
    'max',
    'step',
    'value',
    'size',
  ));
  _form_set_attributes($element, array(
    'form-' . $element['attribute']['type'],
  ));
  return '<input' . new Attribute($element['#attributes']) . ' />';
}