BookOutline::nextLink

public BookOutline::nextLink(array $book_link)

Fetches the book link for the next page of the book.

Parameters

array $book_link: A fully loaded book link that is part of the book hierarchy.

Return value

array A fully loaded book link for the page after the one represented in $book_link.

File

core/modules/book/src/BookOutline.php, line 80

Class

BookOutline
Provides handling to render the book outline.

Namespace

Drupal\book

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public function nextLink(array $book_link) {
  // Assigning the array to $flat resets the array pointer for use with each().
  $flat = $this->bookManager->bookTreeGetFlat($book_link);
  do {
    list($key, ) = each($flat);
  } while ($key && $key != $book_link['nid']);
 
  if ($key == $book_link['nid']) {
    $next = current($flat);
    if ($next) {
      $this->bookManager->bookLinkTranslate($next);
    }
    return $next;
  }
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.