function theme_date_text_parts in Date 8
Same name and namespace in other branches
- 6.2 date/date_admin.inc \theme_date_text_parts()
- 6 date/date_admin.inc \theme_date_text_parts()
- 7.3 date.theme \theme_date_text_parts()
- 7 date.theme \theme_date_text_parts()
- 7.2 date.theme \theme_date_text_parts()
Returns HTML for the text/select options for date parts in a table.
2 theme calls to theme_date_text_parts()
- DateFieldListWidget::settingsForm in date_field/
lib/ Drupal/ date_field/ Plugin/ field/ widget/ DateFieldListWidget.php - Implements Drupal\field\Plugin\Type\Widget\WidgetInterface::settingsForm().
- DateTextWidget::settingsForm in lib/
Drupal/ date/ Plugin/ field/ widget/ DateTextWidget.php - Implements Drupal\field\Plugin\Type\Widget\WidgetInterface::settingsForm().
File
- ./
date.theme, line 337 - Theme functions.
Code
function theme_date_text_parts($variables) {
$element = $variables['element'];
$rows = array();
foreach (DateGranularity::granularityNames() as $key => $part) {
if ($element[$key]['#type'] == 'hidden') {
$rows[] = drupal_render($element[$key]);
}
else {
$rows[] = array(
$part,
drupal_render($element[$key][0]),
drupal_render($element[$key][1]),
);
}
}
if ($element['year']['#type'] == 'hidden') {
return implode($rows) . drupal_render_children($element);
}
else {
$header = array(
t('Date part'),
t('Select list'),
t('Text field'),
);
return theme('table', array(
'header' => $header,
'rows' => $rows,
)) . drupal_render_children($element);
}
}