bookLinkTranslate example

if ($key == $book_link['nid']) {
      // The previous page in the book may be a child of the previous visible link.       if ($prev['depth'] == $book_link['depth']) {
        // The subtree will have only one link at the top level - get its data.         $tree = $this->bookManager->bookSubtreeData($prev);
        $data = array_shift($tree);
        // The link of interest is the last child - iterate to find the deepest one.         while ($data['below']) {
          $data = end($data['below']);
        }
        $this->bookManager->bookLinkTranslate($data['link']);
        return $data['link'];
      }
      else {
        $this->bookManager->bookLinkTranslate($prev);
        return $prev;
      }
    }
  }

  /** * Fetches the book link for the next page of the book. * * @param array $book_link * A fully loaded book link that is part of the book hierarchy. * * @return array * A fully loaded book link for the page after the one represented in * $book_link. */
return $links[$nid] ?? FALSE;
  }

  /** * {@inheritdoc} */
  public function loadBookLinks($nids$translate = TRUE) {
    $result = $this->bookOutlineStorage->loadMultiple($nids$translate);
    $links = [];
    foreach ($result as $link) {
      if ($translate) {
        $this->bookLinkTranslate($link);
      }
      $links[$link['nid']] = $link;
    }

    return $links;
  }

  /** * {@inheritdoc} */
  public function saveBookLink(array $link$new) {
    
Home | Imprint | This part of the site doesn't use cookies.