Commit a27d2222 authored by alexpott's avatar alexpott
Browse files

Issue #2363647 by benjy: Cannot programatically update books

parent 1a8858a0
...@@ -243,9 +243,14 @@ public function updateOutline(NodeInterface $node) { ...@@ -243,9 +243,14 @@ public function updateOutline(NodeInterface $node) {
return FALSE; return FALSE;
} }
if (!empty($node->book['bid']) && $node->book['bid'] == 'new') { if (!empty($node->book['bid'])) {
// New nodes that are their own book. if ($node->book['bid'] == 'new') {
$node->book['bid'] = $node->id(); // 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 // Ensure we create a new book link if either the node itself is new, or the
......
...@@ -166,6 +166,11 @@ function testBook() { ...@@ -166,6 +166,11 @@ function testBook() {
$this->book = $other_book; $this->book = $other_book;
$this->checkBookNode($other_book, array($node), FALSE, FALSE, $node, array()); $this->checkBookNode($other_book, array($node), FALSE, FALSE, $node, array());
$this->checkBookNode($node, NULL, $other_book, $other_book, FALSE, array($other_book)); $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();
} }
/** /**
......
Supports Markdown
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