You are here

function _node_import_preview in Node import 5

3 string references to '_node_import_preview'
_node_import_options_validate in ./node_import.module
_node_import_preview_validate in ./node_import.module
_node_import_start_validate in ./node_import.module

File

./node_import.module, line 391
This modules provides a wizard at "administer >> content >> import" to import a CSV file with nodes.

Code

function _node_import_preview(&$edit) {
  $form[] = array(
    '#type' => 'item',
    '#title' => t('File'),
    '#value' => $edit['filename'] . ' (' . format_size($edit['file']->filesize) . ') ',
  );
  $file_formats = _node_import_get_file_formats();
  $form[] = array(
    '#type' => 'item',
    '#title' => t('File format'),
    '#value' => $file_formats[$edit['file_format']],
  );
  $form[] = array(
    '#type' => 'item',
    '#title' => t('Type'),
    '#value' => node_get_types('name', $edit['type']),
  );
  $form[] = array(
    '#type' => 'markup',
    '#value' => '<p>' . t('Importing may take awhile, do not click "Apply (import nodes)" more than once. To see progress, look at <a href="@admin-content" target="_new">the "administer &gt;&gt; content management &gt;&gt; content" page in a new window</a>.', array(
      '@admin-content' => url('admin/content/node'),
    )) . '</p>',
  );
  if (!$edit['preview_count']) {
    $edit['preview_count'] = 5;
  }
  $edit['errors'] = array();
  $form[] = array(
    '#type' => 'item',
    '#value' => _node_import_get_nodes($edit['file']->filepath, $edit['type'], $edit['type'] == 'node_import' ? NULL : $edit['match'], $edit['global'], $edit['preview_count'], $edit['errors'], $edit['file_format']),
  );
  $form['preview_count'] = array(
    '#type' => 'select',
    '#title' => t('Number of entries to preview'),
    '#default_value' => $edit['preview_count'],
    '#options' => drupal_map_assoc(array(
      5,
      10,
      15,
      25,
      50,
      100,
      150,
      200,
    )),
  );
  $form[] = array(
    '#type' => 'submit',
    '#value' => t('Back'),
  );
  $form[] = array(
    '#type' => 'submit',
    '#value' => t('Reload'),
  );
  $form[] = array(
    '#type' => 'submit',
    '#value' => t('Apply (import nodes)'),
  );
  return $form;
}