You are here

function theme_date_text_parts in Date 6

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. 7.3 date.theme \theme_date_text_parts()
  4. 7 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_widget_settings_form in date/date_admin.inc

File

date/date_admin.inc, line 204
Date administration code. Moved to separate file since there is a lot of code here that is not needed often.

Code

function theme_date_text_parts($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);
  }
  else {
    $header = array(
      t('Input Type'),
      t('Select list'),
      t('Text field'),
    );
    return theme('table', $header, $rows);
  }
}