Hi,
I have an existing node which has additional fields.

Now I want to add a form programmatically to its "body".
To be clear: its just for a single node and not to all nodes of that type.

Which is the best way?

Comments

hook_node_view

hardcode solution:

<?php
function my_module_node_view() {
if (
$node->nid == 12345) {
 
$node->content['my_form'] = array(
   
'#markup' => drupal_render(drupal_get_form('my_custom_form')),
   
'#weight' => 5,
  );
}
}
?>

thanks for the answer. Is it

thanks for the answer.

Is it possible to inject the form in the body-field?

Easy

<?php
function my_module_node_view($node, $view_mode, $langcode) {
if (
$node->type == 'article' && $view_mode == 'full') {
 
$node->content['body'][0]['#markup'] .= drupal_render(drupal_get_form('my_custom_form')),
}
}
?>
nobody click here