I'm using Node Export with the Biblio module, and the Biblio module requires the 'cid' field to be removed from export because it handles those fields differently. It looks like the previous solution with Node Export 2.x was to use biblio_node_export_node_alter() but that doesn't appear to work. Does hook_node_export_node_alter still exist in 3.x or otherwise changed significantly?

This was the original code posted here

function biblio_node_export_node_alter(&$node, $original_node, $method) {
  if ($method == 'export') {
    foreach ($node->biblio_contributors as $cat => $authors) {
      foreach ($authors as $key => $author) {
        unset($node->biblio_contributors[$cat][$key]['cid']);
      }
    }
  }

Comments

danielb’s picture

<?php
/**
 * Manipulate a node on export.
 *
 * @param &$node
 *   The node to alter.
 * @param $original_node
 *   The unaltered node.
 */
function hook_node_export_node_alter(&$node, $original_node) {
  // no example code
}
?>

From node_export.api.php (has all the hooks documented in it) unless this info is wrong....
$method is removed as this hook now only handles exports. A new hook was created for imports hook_node_export_node_import_alter().
Don't forget in D7 you have to clear caches after adding a hook.

danielb’s picture

Noticed a bug at the bottom of that api file where a hook is documented as "node_export_node_export_import" whereas I think it should be "hook_node_export_import".

rory_o’s picture

Status: Active » Closed (fixed)

Thanks, that helped considerably and I have it working.

danielb’s picture

Status: Closed (fixed) » Active

URRGGHHHHH why did you close this
lucky I stumbled on it by chance

one of these days I'm going to snap and start finding out where you people live

danielb’s picture

Status: Active » Fixed

alright I've fixed that and had my medication now

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.