Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
ddff1b3c
Commit
ddff1b3c
authored
Mar 25, 2014
by
catch
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2218691
by dawehner: Move the current user out of the node API chain in book.
parent
0cb6fc70
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/book/book.module
+6
-5
6 additions, 5 deletions
core/modules/book/book.module
with
6 additions
and
5 deletions
core/modules/book/book.module
+
6
−
5
View file @
ddff1b3c
...
@@ -224,8 +224,13 @@ function book_form_node_form_alter(&$form, &$form_state, $form_id) {
...
@@ -224,8 +224,13 @@ function book_form_node_form_alter(&$form, &$form_state, $form_id) {
*
*
* @todo: Remove this in favor of an entity field.
* @todo: Remove this in favor of an entity field.
*/
*/
function
book_node_builder
(
$entity_type
,
$entity
,
&
$form
,
&
$form_state
)
{
function
book_node_builder
(
$entity_type
,
NodeInterface
$entity
,
&
$form
,
&
$form_state
)
{
$entity
->
book
=
$form_state
[
'values'
][
'book'
];
$entity
->
book
=
$form_state
[
'values'
][
'book'
];
// Always save a revision for non-administrators.
if
(
!
empty
(
$entity
->
book
[
'bid'
])
&&
!
\Drupal
::
currentUser
()
->
hasPermission
(
'administer nodes'
))
{
$entity
->
setNewRevision
();
}
}
}
/**
/**
...
@@ -447,10 +452,6 @@ function book_node_view(EntityInterface $node, EntityViewDisplayInterface $displ
...
@@ -447,10 +452,6 @@ function book_node_view(EntityInterface $node, EntityViewDisplayInterface $displ
* Implements hook_node_presave().
* Implements hook_node_presave().
*/
*/
function
book_node_presave
(
EntityInterface
$node
)
{
function
book_node_presave
(
EntityInterface
$node
)
{
// Always save a revision for non-administrators.
if
(
!
empty
(
$node
->
book
[
'bid'
])
&&
!
\Drupal
::
currentUser
()
->
hasPermission
(
'administer nodes'
))
{
$node
->
setNewRevision
();
}
// Make sure a new node gets a new menu link.
// Make sure a new node gets a new menu link.
if
(
$node
->
isNew
())
{
if
(
$node
->
isNew
())
{
$node
->
book
[
'nid'
]
=
NULL
;
$node
->
book
[
'nid'
]
=
NULL
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment