| 5 form.inc | theme_date($element) |
| 6 form.inc | theme_date( |
| 7 form.inc | theme_date($variables) |
| 8 form.inc | theme_date($variables) |
Returns HTML for a date selection form element.
Parameters
$variables: An associative array containing:
- element: An associative array containing the properties of the element. Properties used: #title, #value, #options, #description, #required, #attributes.
Related topics
File
- includes/
form.inc, line 2881 - Functions for form and batch generation and processing.
Code
function theme_date($variables) {
$element = $variables['element'];
$attributes = array();
if (isset($element['#id'])) {
$attributes['id'] = $element['#id'];
}
if (!empty($element['#attributes']['class'])) {
$attributes['class'] = (array) $element['#attributes']['class'];
}
$attributes['class'][] = 'container-inline';
return '<div' . drupal_attributes($attributes) . '>' . drupal_render_children($element) . '</div>';
}
Login or register to post comments
Comments
Chinese Form Date
The default date format does not conform to Chinese's convention. In Chinese, "year" comes first. There is a character "年" after year number and a "日" after day number.
My solution to fix this is that adding following function in theme template.php file:
function zenone_date($variables) {
$variables['element']['year']['#weight'] = -0.001;
$variables['element']['month']['#weight'] = 0;
$variables['element']['day']['#weight'] = 0.001;
$variables['element']['#sorted'] = FALSE;
foreach ($variables['element']['year']['#options'] as &$value) {
$value .= '年';
}
foreach ($variables['element']['day']['#options'] as &$value) {
$value .= '日';
}
return theme_date($variables);
}