You are here

function theme_location_settings in Location 7.5

Same name and namespace in other branches
  1. 5.3 location.module \theme_location_settings()
  2. 6.3 location.module \theme_location_settings()
  3. 7.3 location.module \theme_location_settings()
  4. 7.4 location.module \theme_location_settings()

File

./location.module, line 534
Location module main routines. An implementation of a universal API for location manipulation. Provides functions for postal_code proximity searching, deep-linking into online mapping services. Currently, some options are configured through an…

Code

function theme_location_settings($variables) {
  $element = $variables['element'];
  $rows = array();
  $header = array(
    array(
      'data' => t('Name'),
      'colspan' => 2,
    ),
    t('Collect'),
    t('Widget'),
    t('Default'),
    t('Weight'),
  );

  // Force country required.
  $element['country']['default']['#required'] = TRUE;
  unset($element['country']['collect']['#options'][0]);
  foreach (element_children($element) as $key) {
    $element[$key]['weight']['#attributes']['class'] = array(
      'location-settings-weight',
    );
    unset($element[$key]['default']['#title']);
    $row = array();
    $row[] = array(
      'data' => '',
      'class' => array(
        'location-settings-drag',
      ),
    );
    $row[] = drupal_render($element[$key]['name']);
    $row[] = drupal_render($element[$key]['collect']);
    $row[] = !empty($element[$key]['widget']) ? drupal_render($element[$key]['widget']) : '';
    $row[] = drupal_render($element[$key]['default']);
    $row[] = array(
      'data' => drupal_render($element[$key]['weight']),
      'class' => array(
        'delta-order',
      ),
    );
    $rows[] = array(
      '#weight' => (int) $element[$key]['weight']['#value'],
      'data' => $row,
      'class' => array(
        'draggable',
      ),
    );
  }
  uasort($rows, 'element_sort');
  foreach ($rows as $k => $v) {
    unset($rows[$k]['#weight']);
  }
  drupal_add_tabledrag('location-settings-table', 'order', 'sibling', 'location-settings-weight');
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'location-settings-table',
    ),
  ));

  //return theme('form_element', array('element' => $element));
  return $output;
}