book_update_bid

Versions
6 – 7
book_update_bid($book_link)

Update the bid for a page and its children when it is moved to a new book.

Parameters

$book_link A fully loaded menu link that is part of the book hierarchy.

▾ 1 function calls book_update_bid()

_book_update_outline in modules/book/book.module
Common helper function to handles additions and updates to the book outline.

Code

modules/book/book.module, line 610

<?php
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();
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.