function book_node_load

Same name in other branches
  1. 9 core/modules/book/book.module \book_node_load()
  2. 8.9.x core/modules/book/book.module \book_node_load()
  3. 10 core/modules/book/book.module \book_node_load()
  4. 11.x core/modules/book/book.module \book_node_load()

Implements hook_node_load().

File

modules/book/book.module, line 874

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']);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.