You are here

function theme_location_form in Location 5

File

./location.theme, line 181

Code

function theme_location_form(&$form) {
  foreach (element_children($form) as $field_name) {
    $row = array();
    if ($form[$field_name]['#type'] == 'markup') {
      $row[] = array(
        'data' => $form[$field_name]['#value'],
        'colspan' => 2,
      );
    }
    elseif ($form[$field_name]['#type'] != 'hidden') {
      $required = !empty($form[$field_name]['#required']) ? '<span class="form-required" title="' . t('This field is required.') . '">*</span>' : '';
      $row[] = array(
        'align' => 'right',
        'data' => '<div class="form-item"><label' . ($form[$field_name]['#id'] ? ' for="' . $form[$field_name]['#id'] . '" ' : '') . '>' . filter_xss_admin($form[$field_name]['#title']) . ": {$required}</label></div>",
      );
      unset($form[$field_name]['#title']);
      $description = $form[$field_name]['#description'];
      $row[] = array(
        'align' => 'left',
        'data' => drupal_render($form[$field_name]),
      );
      $rows[] = array(
        'data' => $row,
        'class' => 'odd',
      );
    }
  }
  $output = theme('table', NULL, $rows);
  $output .= drupal_render($form);
  return $output;
}