Skip to content
Snippets Groups Projects
Commit a27d2222 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2363647 by benjy: Cannot programatically update books

parent 1a8858a0
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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();
}
/**
......
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