function BookManager::findChildrenRelativeDepth

Same name in other branches
  1. 9 core/modules/book/src/BookManager.php \Drupal\book\BookManager::findChildrenRelativeDepth()
  2. 8.9.x core/modules/book/src/BookManager.php \Drupal\book\BookManager::findChildrenRelativeDepth()
  3. 10 core/modules/book/src/BookManager.php \Drupal\book\BookManager::findChildrenRelativeDepth()

Determine the relative depth of the children of a given book link.

Parameters

array $book_link: The book link.

Return value

int The difference between the max depth in the book tree and the depth of the passed book link.

1 call to BookManager::findChildrenRelativeDepth()
BookManager::getParentDepthLimit in core/modules/book/src/BookManager.php

File

core/modules/book/src/BookManager.php, line 207

Class

BookManager
Defines a book manager.

Namespace

Drupal\book

Code

protected function findChildrenRelativeDepth(array $book_link) {
    $max_depth = $this->bookOutlineStorage
        ->getChildRelativeDepth($book_link, static::BOOK_MAX_DEPTH);
    return $max_depth > $book_link['depth'] ? $max_depth - $book_link['depth'] : 0;
}

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