function book_node_presave in Drupal 7
Same name and namespace in other branches
- 8 core/modules/book/book.module \book_node_presave()
- 9 core/modules/book/book.module \book_node_presave()
Implements hook_node_presave().
File
- modules/
book/ book.module, line 919 - 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;
}
}