In the function nodereference_uuid_node_features_export_render_alter

when you do

<?php
$export->$field_name = array();

you are actually overriding $node->$field_name, and the original $node->field_name values are lost and not exported.

A drupal_clone must be done before calling the hook.

Comments

Pedro Lozano’s picture

StatusFileSize
new919 bytes

Fixed to avoid php errors.

Pedro Lozano’s picture

Status: Needs review » Needs work
Pedro Lozano’s picture

Status: Needs work » Needs review
phayes’s picture

[Deleted] -- nevermind...

mikehostetler’s picture

Confirmed that this patch fixes the node reference issue.

Additionally, in my testing, when the feature containing the node with the reference is imported into a new site, the reference is not properly recreated the first time the feature is turned on. I had to turn on the feature, revert it, then revert it again. From there, it worked correctly.

netw3rker’s picture

Confirmed, the above patch does fix node references. The only problem is it also includes the referenced node regardless of whether it is already included in another feature, thereby creating conflicts between features.

the patch below does improves upon the patch in #1 by checking the dependency tree for the node being referenced, and if it is already packaged into a feature, a dependency is added to that feature instead of the node. if the node is not already in a feature, it gets added to the feature for packaging.

hope this helps!
-Chris

smokris’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new2.55 KB

@netw3rker's patch in #6 works for me, too — solves the OP's problem, and properly handles nodes already claimed in another Feature.

Re-rolled, in -p1 patch format.