You are here

function theme_date_select in Date 8

Same name and namespace in other branches
  1. 5.2 date_api_elements.inc \theme_date_select()
  2. 6.2 theme/theme.inc \theme_date_select()
  3. 6 date_api_elements.inc \theme_date_select()
  4. 7.3 date_api/theme/theme.inc \theme_date_select()
  5. 7 date_api/theme/theme.inc \theme_date_select()
  6. 7.2 date_api/theme/theme.inc \theme_date_select()

Returns HTML for a date select element.

1 theme call to theme_date_select()
DateTextWidget::settingsForm in lib/Drupal/date/Plugin/field/widget/DateTextWidget.php
Implements Drupal\field\Plugin\Type\Widget\WidgetInterface::settingsForm().

File

date_api/theme/theme.inc, line 29
Theme files for Date API.

Code

function theme_date_select($variables) {
  $element = $variables['element'];
  $attributes = !empty($element['#wrapper_attributes']) ? $element['#wrapper_attributes'] : array(
    'class' => array(),
  );
  $attributes['class'][] = 'container-inline-date';
  $wrapper_attributes = array(
    'class' => array(
      'date-padding',
    ),
  );
  $wrapper_attributes['class'][] = 'clearfix';

  // Add a wrapper to mimic the way a single value field works, for ease in
  // using #states.
  if (isset($element['#children'])) {
    $element['#children'] = '<div id="' . $element['#id'] . '" ' . new Attribute($wrapper_attributes) . '>' . $element['#children'] . '</div>';
  }
  return '<div ' . new Attribute($attributes) . '>' . theme('form_element', $element) . '</div>';
}