Commit 5fea19e8 authored by drumm's avatar drumm
Browse files

Forward port from 4.7

#59935, It's impossible to preserve stuff by calling form_set_value from hook_validate to submit, patch by tenrapid
parent 0991afa0
......@@ -1659,12 +1659,15 @@ function node_form_array($node) {
return $form;
}
function node_form_add_preview($form, $edit) {
function node_form_add_preview($form) {
global $form_values;
$op = isset($_POST['op']) ? $_POST['op'] : '';
if ($op == t('Preview')) {
drupal_validate_form($form['form_id']['#value'], $form);
if (!form_get_errors()) {
$form['node_preview'] = array('#value' => node_preview((object)$edit), '#weight' => -100);
// We pass the global $form_values here to preserve changes made during form validation
$form['node_preview'] = array('#value' => node_preview((object)$form_values), '#weight' => -100);
}
}
if (variable_get('node_preview', 0) && (form_get_errors() || $op != t('Preview'))) {
......
......@@ -1659,12 +1659,15 @@ function node_form_array($node) {
return $form;
}
function node_form_add_preview($form, $edit) {
function node_form_add_preview($form) {
global $form_values;
$op = isset($_POST['op']) ? $_POST['op'] : '';
if ($op == t('Preview')) {
drupal_validate_form($form['form_id']['#value'], $form);
if (!form_get_errors()) {
$form['node_preview'] = array('#value' => node_preview((object)$edit), '#weight' => -100);
// We pass the global $form_values here to preserve changes made during form validation
$form['node_preview'] = array('#value' => node_preview((object)$form_values), '#weight' => -100);
}
}
if (variable_get('node_preview', 0) && (form_get_errors() || $op != t('Preview'))) {
......
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