You are here

function book_node_load in Drupal 7

Same name and namespace in other branches
  1. 8 core/modules/book/book.module \book_node_load()
  2. 9 core/modules/book/book.module \book_node_load()

Implements hook_node_load().

File

modules/book/book.module, line 874
Allows users to create and organize related content in an outline.

Code

function book_node_load($nodes, $types) {
  $result = db_query("SELECT * FROM {book} b INNER JOIN {menu_links} ml ON b.mlid = ml.mlid WHERE b.nid IN (:nids)", array(
    ':nids' => array_keys($nodes),
  ), array(
    'fetch' => PDO::FETCH_ASSOC,
  ));
  foreach ($result as $record) {
    $nodes[$record['nid']]->book = $record;
    $nodes[$record['nid']]->book['href'] = $record['link_path'];
    $nodes[$record['nid']]->book['title'] = $record['link_title'];
    $nodes[$record['nid']]->book['options'] = unserialize($record['options']);
  }
}