You are here

function theme_node_import_field_table in Node import 6

Theme the mapping, defaults and options tables.

1 theme call to theme_node_import_field_table()
node_import_add_form in ./node_import.admin.inc
Creates a new import task by letting the user fill in a wizard.

File

./node_import.admin.inc, line 1237

Code

function theme_node_import_field_table($form) {
  $header = $form['#node_import-columns'];
  $rows = array();
  $groups = array();
  foreach (element_children($form) as $child) {
    if (!isset($form[$child]['#type']) || $form[$child]['#type'] != 'value') {
      $title = check_plain($form[$child]['#title']);
      $description = isset($form[$child]['#description']) ? $form[$child]['#description'] : '';
      $group = isset($form[$child]['#node_import-group']) ? $form[$child]['#node_import-group'] : '';
      unset($form[$child]['#title']);
      unset($form[$child]['#description']);
      if (!isset($groups[$group])) {
        $groups[$group] = array();
      }
      $groups[$group][] = array(
        check_plain($title) . '<div class="description">' . $description . '</div>',
        drupal_render($form[$child]),
      );
    }
  }
  if (isset($groups['']) && !empty($groups[''])) {
    $rows = array_merge($rows, $groups['']);
  }
  foreach ($groups as $group => $items) {
    if ($group !== '' && !empty($items)) {
      $rows[] = array(
        array(
          'data' => $group,
          'colspan' => 2,
          'class' => 'region',
        ),
      );
      $rows = array_merge($rows, $items);
    }
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => $form['#node_import-empty'],
        'colspan' => 2,
      ),
    );
  }
  return theme('table', $header, $rows) . drupal_render($form);
}