Skip to content
Snippets Groups Projects
Commit 055844e7 authored by Neil Drumm's avatar Neil Drumm :wave:
Browse files

#4074 by riccardoR, save the book weights if they aren't editable.

parent a58d8771
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
......@@ -220,7 +220,6 @@ function book_submit(&$node) {
global $user;
// Set default values for non-administrators.
if (!user_access('administer nodes')) {
$node->weight = 0;
$node->revision = 1;
$book->uid = $user->uid;
$book->name = $user->uid ? $user->name : '';
......@@ -276,9 +275,12 @@ function book_form(&$node) {
);
}
else {
// If a regular user updates a book page, we create a new revision
// authored by that user:
$form['revision'] = array('#type' => 'hidden', '#value' => 1);
// If a regular user updates a book page, we preserve the node weight; otherwise
// we use 0 as the default for new pages
$form['weight'] = array(
'#type' => 'value',
'#value' => isset($node->weight) ? $node->weight : 0,
);
}
return $form;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment