Commit a27d2222 authored by alexpott's avatar alexpott

Issue #2363647 by benjy: Cannot programatically update books

parent 1a8858a0
......@@ -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();
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment