public function BookOutlineStorage::insert in Drupal 8
Same name and namespace in other branches
- 9 core/modules/book/src/BookOutlineStorage.php \Drupal\book\BookOutlineStorage::insert()
- 10 core/modules/book/src/BookOutlineStorage.php \Drupal\book\BookOutlineStorage::insert()
Inserts a book link.
Parameters
array $link: The link array to be inserted in the database.
array $parents: The array of parent ids for the link to be inserted.
Return value
mixed The last insert ID of the query, if one exists.
Overrides BookOutlineStorageInterface::insert
File
- core/
modules/ book/ src/ BookOutlineStorage.php, line 128
Class
- BookOutlineStorage
- Defines a storage class for books outline.
Namespace
Drupal\bookCode
public function insert($link, $parents) {
return $this->connection
->insert('book')
->fields([
'nid' => $link['nid'],
'bid' => $link['bid'],
'pid' => $link['pid'],
'weight' => $link['weight'],
] + $parents)
->execute();
}