You are here

function node_export_node_bulk in Node export 6.2

Callback for 'node_export' node operation.

1 call to node_export_node_bulk()
node_export_drush_callback_export in ./node_export.drush.inc
Drush command callback.
1 string reference to 'node_export_node_bulk'
node_export_node_operations in ./node_export.module
Implementation of hook_node_operations().

File

./node_export.module, line 140
The Node Export module.

Code

function node_export_node_bulk($nids, $return_code = FALSE, $format = NULL) {
  $nodes = array();
  foreach ($nids as $nid) {
    $nodes[] = node_load($nid);
  }

  // Let other modules do special fixing up.
  // The function signature is: hook_node_export_node_bulk_alter(&$nodes, $op).
  // Where $op is 'export'.
  drupal_alter('node_export_node_bulk', $nodes, 'export', $format);

  // Allow other modules to take over this entire process. Typically the module
  // would respond if $format was set to something it recognises.
  $node_code = FALSE;
  drupal_alter('node_export_node_bulk_encode', $node_code, $nodes, $format);

  // Default handling of bulk node code.
  if ($node_code === FALSE) {
    $node_codes = array();
    foreach ($nodes as $node) {
      $node_codes[] = node_export_node_export($node, TRUE, 1);
    }
    $node_code = "array(\n  " . implode(",\n  ", $node_codes) . ",\n)";
  }
  if ($return_code) {
    return $node_code;
  }
  if (variable_get('node_export_bulk_code', 'copy') == 'copy') {
    drupal_set_message(drupal_get_form('node_export_form', $node_code));
  }
  else {
    node_export_get_file($nids, $node_code, TRUE);
  }
}