BookManager::getActiveTrailIds

public BookManager::getActiveTrailIds($bid, $link)

Gets the active trail IDs for the specified book at the provided path.

Parameters

string $bid: The Book ID to find links for.

array $link: A fully loaded menu link.

Return value

array An array containing the active trail: a list of mlids.

Overrides BookManagerInterface::getActiveTrailIds

File

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

Class

BookManager
Defines a book manager.

Namespace

Drupal\book

Code

public function getActiveTrailIds($bid, $link) {
  // The tree is for a single item, so we need to match the values in its
  // p columns and 0 (the top level) with the plid values of other links.
  $active_trail = array(0);
  for ($i = 1; $i < static::BOOK_MAX_DEPTH; $i++) {
    if (!empty($link["p$i"])) {
      $active_trail[] = $link["p$i"];
    }
  }
  return $active_trail;
}
doc_Drupal
2016-10-29 08:48:10
Comments
Leave a Comment

Please login to continue.