function book_node_presave

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

Implements hook_ENTITY_TYPE_presave() for node entities.

File

core/modules/book/book.module, line 253

Code

function book_node_presave(EntityInterface $node) {
    // Make sure a new node gets a new menu link.
    if ($node->isNew()) {
        $node->book['nid'] = NULL;
    }
}

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