function BookManager::bookTreeCheckAccess

Same name in this branch
  1. 11.x core/modules/book/src/ProxyClass/BookManager.php \Drupal\book\ProxyClass\BookManager::bookTreeCheckAccess()
Same name in other branches
  1. 9 core/modules/book/src/BookManager.php \Drupal\book\BookManager::bookTreeCheckAccess()
  2. 8.9.x core/modules/book/src/BookManager.php \Drupal\book\BookManager::bookTreeCheckAccess()
  3. 10 core/modules/book/src/ProxyClass/BookManager.php \Drupal\book\ProxyClass\BookManager::bookTreeCheckAccess()
  4. 10 core/modules/book/src/BookManager.php \Drupal\book\BookManager::bookTreeCheckAccess()
2 calls to BookManager::bookTreeCheckAccess()
BookManager::bookSubtreeData in core/modules/book/src/BookManager.php
BookManager::bookTreeBuild in core/modules/book/src/BookManager.php
Builds a book tree, translates links, and checks access.

File

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

Class

BookManager
Defines a book manager.

Namespace

Drupal\book

Code

public function bookTreeCheckAccess(&$tree, $node_links = []) {
    if ($node_links) {
        // @todo Extract that into its own method.
        $nids = array_keys($node_links);
        // @todo This should be actually filtering on the desired node status
        //   field language and just fall back to the default language.
        $book_links = $this->bookOutlineStorage
            ->loadMultiple($nids);
        foreach ($book_links as $book_link) {
            $nid = $book_link['nid'];
            foreach ($node_links[$nid] as $menu_link_id => $link) {
                $node_links[$nid][$menu_link_id]['access'] = TRUE;
            }
        }
    }
    $this->doBookTreeCheckAccess($tree);
}

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