Skip to content
Snippets Groups Projects
Commit 45092bdd authored by Gerhard Killesreiter's avatar Gerhard Killesreiter
Browse files

#53012, make "Create new revision" respect node type settings, patch by Zen

parent efa8b042
No related branches found
No related tags found
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
...@@ -1584,11 +1584,9 @@ function node_submit($node) { ...@@ -1584,11 +1584,9 @@ function node_submit($node) {
$node->uid = $user->uid ? $user->uid : 0; $node->uid = $user->uid ? $user->uid : 0;
// Force defaults in case people modify the form: // Force defaults in case people modify the form:
$node_options = variable_get('node_options_'. $node->type, array('status', 'promote')); $node_options = variable_get('node_options_'. $node->type, array('status', 'promote'));
$node->status = in_array('status', $node_options); foreach (array('status', 'moderate', 'promote', 'sticky', 'revision') as $key) {
$node->moderate = in_array('moderate', $node_options); $node->$key = in_array($key, $node_options);
$node->promote = in_array('promote', $node_options); }
$node->sticky = in_array('sticky', $node_options);
$node->revision = in_array('revision', $node_options);
unset($node->created); unset($node->created);
} }
...@@ -1710,6 +1708,10 @@ function node_form_array($node) { ...@@ -1710,6 +1708,10 @@ function node_form_array($node) {
$form['options'][$key] = array('#type' => 'value', '#value' => $node->$key); $form['options'][$key] = array('#type' => 'value', '#value' => $node->$key);
} }
} }
else {
// Nodes being edited should always be preset with the default revision setting.
$node->revision = in_array('revision', $node_options);
}
$form['#node'] = $node; $form['#node'] = $node;
if (user_access('administer nodes')) { if (user_access('administer nodes')) {
......
...@@ -1584,11 +1584,9 @@ function node_submit($node) { ...@@ -1584,11 +1584,9 @@ function node_submit($node) {
$node->uid = $user->uid ? $user->uid : 0; $node->uid = $user->uid ? $user->uid : 0;
// Force defaults in case people modify the form: // Force defaults in case people modify the form:
$node_options = variable_get('node_options_'. $node->type, array('status', 'promote')); $node_options = variable_get('node_options_'. $node->type, array('status', 'promote'));
$node->status = in_array('status', $node_options); foreach (array('status', 'moderate', 'promote', 'sticky', 'revision') as $key) {
$node->moderate = in_array('moderate', $node_options); $node->$key = in_array($key, $node_options);
$node->promote = in_array('promote', $node_options); }
$node->sticky = in_array('sticky', $node_options);
$node->revision = in_array('revision', $node_options);
unset($node->created); unset($node->created);
} }
...@@ -1710,6 +1708,10 @@ function node_form_array($node) { ...@@ -1710,6 +1708,10 @@ function node_form_array($node) {
$form['options'][$key] = array('#type' => 'value', '#value' => $node->$key); $form['options'][$key] = array('#type' => 'value', '#value' => $node->$key);
} }
} }
else {
// Nodes being edited should always be preset with the default revision setting.
$node->revision = in_array('revision', $node_options);
}
$form['#node'] = $node; $form['#node'] = $node;
if (user_access('administer nodes')) { if (user_access('administer nodes')) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment