Hi, I'm trying to use "hook_node_clone_alter()" to empty some fields after the form is prepopulated but I have no luck on finding the proper way to access the field. I'm using:

<?php
function mymodule_clone_node_alter(&$node, $context) {
  if ($context['original_node']->type == 'mynodetypename' AND $context['method'] == 'prepopulate') {
    // Empty resource link
    $node->field_reference_type['und'][0]['#value'] = '';
    $node->field_text_type['und'][0]['#value'] = 'Some text here...';
  }
}
?>

But nothing happens when the form is presented. I understand that the "prepopulate" method acts before the form is presented to the use, so the node reference field could be emptied on my case. Is it right? Any idea on where is my code wrong?

Thanks in advance.

Comments

JordiTR’s picture

Issue summary: View changes
JordiTR’s picture

Issue summary: View changes
pwolanin’s picture

Status: Active » Closed (cannot reproduce)