You are here

function theme_date_text_parts in Date 7

Same name and namespace in other branches
  1. 8 date.theme \theme_date_text_parts()
  2. 6.2 date/date_admin.inc \theme_date_text_parts()
  3. 6 date/date_admin.inc \theme_date_text_parts()
  4. 7.3 date.theme \theme_date_text_parts()
  5. 7.2 date.theme \theme_date_text_parts()

Display the text/select options for date parts in a table for easier readability.

1 theme call to theme_date_text_parts()
_date_field_widget_settings_form in ./date_admin.inc

File

./date.theme, line 306
Theme functions.

Code

function theme_date_text_parts($vars) {
  $element = $vars['element'];
  $names = date_granularity_names();
  $rows = array();
  foreach ($names as $key => $part) {
    if ($element[$key]['#type'] == 'hidden') {
      $rows[] = drupal_render($element[$key]);
    }
    else {
      $rows[] = array(
        $names[$key],
        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('Input Type'),
      t('Select list'),
      t('Text field'),
    );
    return theme('table', array(
      'header' => $header,
      'rows' => $rows,
    )) . drupal_render_children($element);
  }
}