You are here

function theme_date_text_parts_theme in Date 5.2

Same name and namespace in other branches
  1. 5 date_admin.inc \theme_date_text_parts_theme()

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

1 theme call to theme_date_text_parts_theme()
date_widget_settings_form in date/date_admin.inc

File

date/date_admin.inc, line 192
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_theme($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);
  }
}