function book_update_bid
book_update_bid($book_link)
Updates the book ID of a page and its children when it moves to a new book.
Parameters
$book_link: A fully loaded menu link that is part of the book hierarchy.
File
- modules/book/book.module, line 692
- Allows users to create and organize related content in an outline.
Code
function book_update_bid($book_link) { $query = db_select('menu_links'); $query->addField('menu_links', 'mlid'); for ($i = 1; $i <= MENU_MAX_DEPTH && $book_link["p$i"]; $i++) { $query->condition("p$i", $book_link["p$i"]); } $mlids = $query->execute()->fetchCol(); if ($mlids) { db_update('book') ->fields(array('bid' => $book_link['bid'])) ->condition('mlid', $mlids, 'IN') ->execute(); } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!book!book.module/function/book_update_bid/7.x