diff --git a/node_export.pages.inc b/node_export.pages.inc index 0e32856..0308012 100755 --- a/node_export.pages.inc +++ b/node_export.pages.inc @@ -287,6 +287,8 @@ function node_export_settings($form, &$form_state) { * The node export form or nothing if calling function to serve file. */ function node_export_gui($nodes = NULL, $format = NULL, $delivery = NULL) { + $nids = NULL; + $code_string = NULL; // Get the $code_string. if ($nodes) { // $nodes passed in, get the code_string. @@ -377,6 +379,9 @@ function node_export_nodes_to_nids($nodes) { * The built form array. */ function node_export_form($form, &$form_state, $nids, $code_string, $format) { + if(!empty($nids) && is_array($nids)){ + $nids = implode(",", $nids); + } $form = array(); if (variable_get('node_export_code', 'all') == 'all') { $form['nids'] = array( @@ -413,9 +418,9 @@ function node_export_form($form, &$form_state, $nids, $code_string, $format) { */ function node_export_form_submit($form, &$form_state) { // Get file. - $nids = $form_state['values']['nids']; - $code_string = $form_state['values']['export']; - $format = $form_state['values']['format']; + $nids = $form_state['input']['nids']; + $code_string = $form_state['input']['export']; + $format = $form_state['input']['format']; node_export_get_file($nids, $code_string, $format); } @@ -431,13 +436,13 @@ function node_export_form_submit($form, &$form_state) { */ function node_export_get_file($nids, $code_string, $format = NULL) { $filename_data = array(); - $filename_data['node-count'] = count($nids); + $filename_data['node-count'] = count(explode(",", $nids)); $filename_data['timestamp'] = REQUEST_TIME; $filename_data['format'] = $format ? $format : 'export'; // Add a list of nids if (count($nids) <= variable_get('node_export_file_list', 10)) { - $filename_data['nid-list'] = '[' . implode(',', $nids) . ']'; + $filename_data['nid-list'] = '[' . $nids . ']'; } $name = variable_get('node_export_filename', 'node-export[node_export_filename:nid-list]([node_export_filename:node-count]-nodes).[node_export_filename:timestamp].[node_export_filename:format]'); $data = array('node_export_filename' => (object)$filename_data);