function book_node_presave

7.x book.module book_node_presave($node)

Implements hook_node_presave().

File

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

Code

function book_node_presave($node) {
  // Always save a revision for non-administrators.
  if (!empty($node->book['bid']) && !user_access('administer nodes')) {
    $node->revision = 1;
    // The database schema requires a log message for every revision.
    if (!isset($node->log)) {
      $node->log = '';
    }
  }
  // Make sure a new node gets a new menu link.
  if (empty($node->nid)) {
    $node->book['mlid'] = NULL;
  }
}