function BookOutlineStorage::getChildRelativeDepth
Same name in other branches
- 9 core/modules/book/src/BookOutlineStorage.php \Drupal\book\BookOutlineStorage::getChildRelativeDepth()
- 8.9.x core/modules/book/src/BookOutlineStorage.php \Drupal\book\BookOutlineStorage::getChildRelativeDepth()
- 10 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();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.