You are here

function node_export_alter in Default Content 7

Same name and namespace in other branches
  1. 7.2 plugins/node.inc \node_export_alter()

Handles the main transfer of data from node to export

We did at first try to move all things that were in node but some times this include node and so we had recusion issue when exporting also feature were overridden way to often

File

plugins/node.inc, line 21

Code

function node_export_alter(&$node, &$export) {
  $keys = array(
    'title',
    'status',
    'promote',
    'sticky',
    'type',
    'language',
    'created',
    'comment',
    'translate',
    'machine_name',
    'body',
  );

  // grab core properties
  foreach ($keys as $key) {
    if (isset($node->{$key})) {
      $export->{$key} = $node->{$key};
    }
  }

  //grab all fields that are not empty
  foreach (get_object_vars($node) as $key => $value) {
    if (preg_match("/^field_/", $key) && !empty($value)) {
      $export->{$key} = $node->{$key};
    }
  }
}