Index: install_profile_api/contrib/export.inc =================================================================== --- install_profile_api/contrib/export.inc (revision 2233) +++ install_profile_api/contrib/export.inc (working copy) @@ -15,8 +15,12 @@ * An array of node properties to override for each node imported. * @param $author * The user all imported nodes should be authored by. + * @param $multiple + * By default will expect the file to have multiple records or a nested + * array of nodes, change this to FALSE will interpret this as a single + * node. */ -function install_node_export_import_from_file($file, $properties = array(), $author = NULL) { +function install_node_export_import_from_file($file, $properties = array(), $author = NULL, $multiple = TRUE) { if (!file_exists($file)) { return FALSE; } @@ -47,8 +51,13 @@ // to use reuse the node_export code. $export = file_get_contents($file); $node_code = str_replace('node(code(', 'array(array(', $export); - $imported_nodes = eval("return " . $node_code . ";"); + eval("$"."imported_nodes = " . $node_code . ";"); + // handle nodes exported individually + if (!$multiple) { + $imported_nodes = array($imported_nodes); + } + $saved_nodes = array(); foreach ($imported_nodes as $node) {