Commit fe938b84 authored by Steven Wittens's avatar Steven Wittens

- #35434: Form API - obsolete $param to hook_form() + preview fixes

parent 34fcf45d
......@@ -1608,13 +1608,7 @@ function node_form($node) {
$form['type'] = array('#type' => 'value', '#value' => $node->type);
// Get the node-specific bits.
// We can't use node_invoke() because $param must be passed by reference.
$function = node_get_base($node) .'_form';
$param = array();
if (function_exists($function)) {
$node_form = $function($node, $param);
$form = array_merge($form, $function($node, $param));
}
$form = array_merge($form, node_invoke($node, 'form'));
/**
* Node author information
......@@ -1772,7 +1766,9 @@ function node_preview($node) {
// Display a preview of the node:
// Previewing alters $node so it needs to be cloned.
if (!form_get_errors()) {
$output = theme('node_preview', drupal_clone($node));
$cloned_node = drupal_clone($node);
$cloned_node->in_preview = TRUE;
$output = theme('node_preview', $cloned_node);
}
drupal_set_title(t('Preview'));
drupal_set_breadcrumb(array(l(t('Home'), NULL), l(t('create content'), 'node/add'), l(t('Submit %name', array('%name' => node_get_name($node))), 'node/add/'. $node->type)));
......
......@@ -1608,13 +1608,7 @@ function node_form($node) {
$form['type'] = array('#type' => 'value', '#value' => $node->type);
// Get the node-specific bits.
// We can't use node_invoke() because $param must be passed by reference.
$function = node_get_base($node) .'_form';
$param = array();
if (function_exists($function)) {
$node_form = $function($node, $param);
$form = array_merge($form, $function($node, $param));
}
$form = array_merge($form, node_invoke($node, 'form'));
/**
* Node author information
......@@ -1772,7 +1766,9 @@ function node_preview($node) {
// Display a preview of the node:
// Previewing alters $node so it needs to be cloned.
if (!form_get_errors()) {
$output = theme('node_preview', drupal_clone($node));
$cloned_node = drupal_clone($node);
$cloned_node->in_preview = TRUE;
$output = theme('node_preview', $cloned_node);
}
drupal_set_title(t('Preview'));
drupal_set_breadcrumb(array(l(t('Home'), NULL), l(t('create content'), 'node/add'), l(t('Submit %name', array('%name' => node_get_name($node))), 'node/add/'. $node->type)));
......
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