function _node_import_start in Node import 5
4 string references to '_node_import_start'
- node_import_page in ./
node_import.module - Menu callback function.
- _node_import_import_validate in ./
node_import.module - _node_import_mapping_validate in ./
node_import.module - _node_import_preview_validate in ./
node_import.module
File
- ./
node_import.module, line 125 - This modules provides a wizard at "administer >> content >> import" to import a CSV file with nodes.
Code
function _node_import_start(&$edit) {
if ($edit['file']) {
$form['file'] = array(
'#type' => 'value',
'#value' => $edit['file'],
);
$form[] = array(
'#type' => 'item',
'#title' => t('File'),
'#value' => $edit['filename'] . ' (' . format_size($edit['file']->filesize) . ')',
);
}
else {
$form['file'] = array(
'#type' => 'file',
'#title' => t('Upload file'),
'#size' => 48,
'#description' => t('File containing the data to be imported.'),
);
}
if ($edit['file_format'] && $edit['file_format'] != '') {
$file_formats = _node_import_get_file_formats();
$form[] = array(
'#type' => 'item',
'#title' => t('File format'),
'#value' => $file_formats[$edit['file_format']],
);
}
else {
$form['file_format'] = array(
'#type' => 'select',
'#title' => t('File format'),
'#options' => _node_import_get_file_formats(),
'#default_value' => isset($edit['file_format']) ? $edit['file_format'] : '',
);
}
// Only allow import of nodes for which the user has 'create' privileges
$types = node_import_types(TRUE);
$form['type'] = array(
'#type' => 'select',
'#title' => t('Type'),
'#default_value' => $edit['type'],
'#options' => $types,
);
if ($edit['file']) {
$form[] = array(
'#type' => 'submit',
'#value' => t('Use a different file'),
);
}
$form[] = array(
'#type' => 'submit',
'#value' => t('Next (mapping)'),
);
$form['#attributes'] = array(
'enctype' => 'multipart/form-data',
);
return $form;
}