Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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
Comment #1
JordiTR CreditAttribution: JordiTR commentedComment #2
JordiTR CreditAttribution: JordiTR commentedComment #3
pwolanin CreditAttribution: pwolanin as a volunteer and at Acquia commented