book_revision_load

Versions
4.6
book_revision_load($page, $conditions = array())

Return the most recent revision that matches the specified conditions.

Code

modules/book.module, line 283

<?php
function book_revision_load($page, $conditions = array()) {

  $revisions = array_reverse(node_revision_list($page));

  foreach ($revisions as $revision) {

    // Extract the specified revision:
    $node = node_revision_load($page, $revision);

    // Check to see if the conditions are met:
    $status = TRUE;

    foreach ($conditions as $key => $value) {
      if ($node->$key != $value) {
        $status = FALSE;
      }
    }

    if ($status) {
      return $node;
    }
  }
}
?>
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.