You are here

function theme_countries_import_bulk_import_selection_form in Countries 8

File

modules/countries_import/countries_import.admin.inc, line 251

Code

function theme_countries_import_bulk_import_selection_form($variables) {
  $elements = $variables['element'];
  $header = array(
    t('Skip'),
    t('Status'),
    t('Name'),
    t('Official name'),
    t('ISO alpha-2 code'),
    t('ISO alpha-3 code'),
    t('ISO numeric-3 code'),
    t('Continent'),
  );
  $rows = array();
  foreach (element_children($elements) as $child) {
    $row = array();
    $element =& $elements[$child];
    foreach (array(
      'skip' => 0,
      'enabled' => 0,
      'name' => 25,
      'official_name' => 25,
      'iso2' => 3,
      'iso3' => 4,
      'numcode' => 4,
      'continent' => 0,
    ) as $property => $size) {
      $element[$property]['#title_display'] = 'invisible';
      if (in_array($property, array(
        'skip',
        'enabled',
      )) && isset($element[$property]['#description'])) {
        unset($element[$property]['#description']);
      }
      if ($size) {
        $element[$property]['#size'] = $size;
      }
      $row[] = drupal_render($element[$property]) . ($property == 'continent' ? drupal_render($element) : '');
    }
    $rows[] = $row;
  }
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'empty' => t('No countries were found to update.'),
  )) . drupal_render_children($elements);
}