public function BookOutlineStorage::getChildRelativeDepth in Drupal 10
Same name and namespace in other branches
- 8 core/modules/book/src/BookOutlineStorage.php \Drupal\book\BookOutlineStorage::getChildRelativeDepth()
- 9 core/modules/book/src/BookOutlineStorage.php \Drupal\book\BookOutlineStorage::getChildRelativeDepth()
File
- core/
modules/ book/ src/ BookOutlineStorage.php, line 61
Class
- BookOutlineStorage
- Defines a storage class for books outline.
Namespace
Drupal\bookCode
public function getChildRelativeDepth($book_link, $max_depth) {
$query = $this->connection
->select('book');
$query
->addField('book', 'depth');
$query
->condition('bid', $book_link['bid']);
$query
->orderBy('depth', 'DESC');
$query
->range(0, 1);
$i = 1;
$p = 'p1';
while ($i <= $max_depth && $book_link[$p]) {
$query
->condition($p, $book_link[$p]);
$p = 'p' . ++$i;
}
return $query
->execute()
->fetchField();
}