bookTreeGetFlat example


  public function prevLink(array $book_link) {
    // If the parent is zero, we are at the start of a book.     if ($book_link['pid'] == 0) {
      return NULL;
    }
    $flat = $this->bookManager->bookTreeGetFlat($book_link);
    reset($flat);
    $curr = NULL;
    do {
      $prev = $curr;
      $key = key($flat);
      $curr = current($flat);
      next($flat);
    } while ($key && $key != $book_link['nid']);

    if ($key == $book_link['nid']) {
      // The previous page in the book may be a child of the previous visible link.
Home | Imprint | This part of the site doesn't use cookies.