public function BookManager::bookTreeCheckAccess in Drupal 9
Same name and namespace in other branches
- 8 core/modules/book/src/BookManager.php \Drupal\book\BookManager::bookTreeCheckAccess()
Checks access and performs dynamic operations for each link in the tree.
Parameters
array $tree: The book tree you wish to operate on.
array $node_links: A collection of node link references generated from $tree by menu_tree_collect_node_links().
Overrides BookManagerInterface::bookTreeCheckAccess
2 calls to BookManager::bookTreeCheckAccess()
- BookManager::bookSubtreeData in core/
modules/ book/ src/ BookManager.php - Gets the data representing a subtree of the book hierarchy.
- 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 1013
Class
- BookManager
- Defines a book manager.
Namespace
Drupal\bookCode
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 $mlid => $link) {
$node_links[$nid][$mlid]['access'] = TRUE;
}
}
}
$this
->doBookTreeCheckAccess($tree);
}