function theme_date_text in Date 7.2
Same name and namespace in other branches
- 5.2 date_api_elements.inc \theme_date_text()
- 6.2 theme/theme.inc \theme_date_text()
- 6 date_api_elements.inc \theme_date_text()
- 7.3 date_api/theme/theme.inc \theme_date_text()
- 7 date_api/theme/theme.inc \theme_date_text()
Returns HTML for a date text element.
File
- date_api/
theme/ theme.inc, line 43 - Theme files for Date API.
Code
function theme_date_text($variables) {
$element = $variables['element'];
$attributes = !empty($element['#wrapper_attributes']) ? $element['#wrapper_attributes'] : array(
'class' => array(),
);
$attributes['class'][] = 'container-inline-date';
// If there is no description, the floating date elements need some extra
// padding below them.
$wrapper_attributes = array(
'class' => array(
'date-padding',
),
);
if (empty($element['date']['#description'])) {
$wrapper_attributes['class'][] = 'clearfix';
}
// Add an 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'] . '" ' . drupal_attributes($wrapper_attributes) . '>' . $element['#children'] . '</div>';
}
return '<div ' . drupal_attributes($attributes) . '>' . theme('form_element', $element) . '</div>';
}