function data_export_import_import_nodes_form in Data export import 7
Function to create form to import nodes.
1 string reference to 'data_export_import_import_nodes_form'
- data_export_import_callback_import_nodes in includes/
profiles/ nodes.inc - Callback function to import nodes.
File
- includes/
profiles/ nodes.inc, line 432 - Enables nodes to be exported and imported.
Code
function data_export_import_import_nodes_form($form_state) {
$form = array();
$form['import_nodes'] = array(
'#type' => 'fieldset',
'#title' => t('Import nodes'),
'#collapsible' => FALSE,
'#collapsed' => FALSE,
);
// Get the contents of the dataset directory and create a list of
// links to dataset files.
$directory = variable_get('file_public_path', conf_path() . '/files') . "/data_export_import/nodes";
$mask = '/.dataset/';
$files = file_scan_directory($directory, $mask);
// Sort them by the filename which is used as the key. Since the
// files are named using datetime stamps they will be listed in
// date/time order.
ksort($files);
$options = array();
$options['none'] = t('None');
foreach ($files as $file) {
$options[$file->filename] = check_plain($file->filename);
}
$form['import_nodes']['dataset_file'] = array(
'#type' => 'radios',
'#title' => t('Select file to import.'),
'#default_value' => 'none',
'#options' => $options,
);
$form['import_nodes']['submit'] = array(
'#type' => 'submit',
'#value' => t('Import dataset files'),
);
return $form;
}