Skip to content
Snippets Groups Projects
Commit 54671976 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #101319 by pwolanin: make sure that node->revision can be altered.

parent 36cdf061
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -2022,6 +2022,19 @@ function node_object_prepare(&$node) {
$node->date = format_date($node->created, 'custom', 'Y-m-d H:i:s O');
}
}
$node_options = variable_get('node_options_'. $node->type, array('status', 'promote'));
// If this is a new node, fill in the default values.
if (!isset($node->nid)) {
foreach (array('status', 'promote', 'sticky') as $key) {
$node->$key = in_array($key, $node_options);
}
global $user;
$node->uid = $user->uid;
}
// Always use the default revision setting.
$node->revision = in_array('revision', $node_options);
node_invoke($node, 'prepare');
node_invoke_nodeapi($node, 'prepare');
}
......@@ -2067,18 +2080,6 @@ function node_form(&$form_state, $node) {
$form['title']['#weight'] = -5;
}
$node_options = variable_get('node_options_'. $node->type, array('status', 'promote'));
// If this is a new node, fill in the default values.
if (!isset($node->nid)) {
foreach (array('status', 'promote', 'sticky') as $key) {
$node->$key = in_array($key, $node_options);
}
global $user;
$node->uid = $user->uid;
}
// Always use the default revision setting.
$node->revision = in_array('revision', $node_options);
$form['#node'] = $node;
// Add a log field if the "Create new revision" option is checked, or if the
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment