You are here

function theme_partial_date_format_settings_form in Partial Date 7

File

./partial_date.pages.inc, line 207
Page and form callbacks for handling the date format.

Code

function theme_partial_date_format_settings_form($variables) {
  $form = $variables['form'];
  $rows = array();
  foreach (element_children($form, TRUE) as $key) {
    $form[$key]['weight']['#attributes']['class'] = array(
      'partial-date-format-order-weight',
    );
    $row = array();
    $row[] = drupal_render($form[$key]['label']);
    if (in_array($key, array(
      'c1',
      'c2',
      'c3',
      'approx',
    ))) {
      $row[] = array(
        'data' => drupal_render($form[$key]['value']),
        'colspan' => 2,
      );
    }
    else {
      $row[] = drupal_render($form[$key]['format']);
      $row[] = drupal_render($form[$key]['empty']);
    }
    $row[] = drupal_render($form[$key]['weight']);
    $rows[] = array(
      'data' => $row,
      'class' => array(
        'draggable',
      ),
    );
  }
  $header = array(
    t('Component'),
    t('Value format'),
    t('Value empty text'),
    t('Weight'),
  );
  drupal_add_tabledrag('partial-date-format-order', 'order', 'sibling', 'partial-date-format-order-weight');
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'partial-date-format-order',
    ),
  ));
}