Commit d048681f authored by drumm's avatar drumm

#63990 by Heine and chx, allow commenting on nodes containing forms

parent fcee5e4f
......@@ -60,6 +60,11 @@ function element_children($element) {
*/
function drupal_get_form($form_id, &$form, $callback = NULL) {
global $form_values, $form_submitted, $user, $form_button_counter;
static $saved_globals = array();
// Save globals in case of indirect recursive call
array_push($saved_globals, array($form_values, $form_submitted, $form_button_counter));
$form_values = array();
$form_submitted = FALSE;
$form_button_counter = array(0, 0);
......@@ -155,7 +160,10 @@ function drupal_get_form($form_id, &$form, $callback = NULL) {
}
}
return form_render($form);
$output = form_render($form);
// Restore globals
list($form_values, $form_submitted, $form_button_counter) = array_pop($saved_globals);
return $output;
}
function drupal_validate_form($form_id, $form, $callback = NULL) {
......
......@@ -1450,7 +1450,7 @@ function comment_form_add_preview($form, $edit) {
$output .= theme('comment_view', $comment);
}
else {
$output .= node_view(node_load($edit['nid']));
$form['#suffix'] = node_view(node_load($edit['nid']));
$edit['pid'] = 0;
}
......
......@@ -1450,7 +1450,7 @@ function comment_form_add_preview($form, $edit) {
$output .= theme('comment_view', $comment);
}
else {
$output .= node_view(node_load($edit['nid']));
$form['#suffix'] = node_view(node_load($edit['nid']));
$edit['pid'] = 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment