Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
a27d2222
Commit
a27d2222
authored
Nov 24, 2014
by
alexpott
Browse files
Issue
#2363647
by benjy: Cannot programatically update books
parent
1a8858a0
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/modules/book/src/BookManager.php
View file @
a27d2222
...
...
@@ -243,9 +243,14 @@ public function updateOutline(NodeInterface $node) {
return
FALSE
;
}
if
(
!
empty
(
$node
->
book
[
'bid'
])
&&
$node
->
book
[
'bid'
]
==
'new'
)
{
// New nodes that are their own book.
$node
->
book
[
'bid'
]
=
$node
->
id
();
if
(
!
empty
(
$node
->
book
[
'bid'
]))
{
if
(
$node
->
book
[
'bid'
]
==
'new'
)
{
// New nodes that are their own book.
$node
->
book
[
'bid'
]
=
$node
->
id
();
}
elseif
(
!
isset
(
$node
->
book
[
'original_bid'
]))
{
$node
->
book
[
'original_bid'
]
=
$node
->
book
[
'bid'
];
}
}
// Ensure we create a new book link if either the node itself is new, or the
...
...
core/modules/book/src/Tests/BookTest.php
View file @
a27d2222
...
...
@@ -166,6 +166,11 @@ function testBook() {
$this
->
book
=
$other_book
;
$this
->
checkBookNode
(
$other_book
,
array
(
$node
),
FALSE
,
FALSE
,
$node
,
array
());
$this
->
checkBookNode
(
$node
,
NULL
,
$other_book
,
$other_book
,
FALSE
,
array
(
$other_book
));
// Test that we can save a book programatically.
$this
->
drupalLogin
(
$this
->
book_author
);
$book
=
$this
->
createBookNode
(
'new'
);
$book
->
save
();
}
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment