I've added two new content types, Son and Father.

When I'm on the node/add/son page, I'd like to display the Father node (with nid=123) before the son_node_form.
This is the code I've written so far:

function sons_form_alter(&$form, $form_state, $form_id) {

  switch ($form_id) :
    case 'son_node_form':
      $father = node_load(123);

      /* What do I need to write here? */

    break;
  endswitch;
	
}

As I said, what do I need to write there?

In other words, how can I "transform" a node into its FormAPI-equivalent?
As an alternative, can I use a form-son-node-form.tpl.php (or something like this) template to theme the son_node_form?

Thanks for any hint.

Comments

dropall’s picture

+1

dropall’s picture


$father = node_load(123);

//===============================
// Prepare our node to display
$father->formnode_embeded = TRUE; 
$node_embeded = array(
				'#type' => 'markup',
				'#value' => node_view($father, FALSE, FALSE),
				'#weight' => -99,
			);
$form['formnode_embeded'] = $node_embeded;
//===============================
  			
break;