You are here

function bookblock_book_info_load in Book Block 7

Same name and namespace in other branches
  1. 6 bookblock.module \bookblock_book_info_load()

Loads the minimum information from the database needed to created a book menu.

1 call to bookblock_book_info_load()
bookblock_block_view in ./bookblock.module
Implements hook_block_view().

File

./bookblock.module, line 141
Enables users to add specific book navigation blocks on non-book pages.

Code

function bookblock_book_info_load($nid) {
  if ($book = db_query('SELECT * FROM {book} b INNER JOIN {menu_links} ml ON b.mlid = ml.mlid WHERE b.nid = :nid', array(
    ':nid' => $nid,
  ))
    ->fetchAssoc()) {
    $book['href'] = $book['link_path'];
    $book['title'] = $book['link_title'];
    $book['options'] = unserialize($book['options']);
    return $book;
  }
}