BookManager::bookTreeCheckAccess

public BookManager::bookTreeCheckAccess(&$tree, $node_links = array())

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

File

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

Class

BookManager
Defines a book manager.

Namespace

Drupal\book

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public function bookTreeCheckAccess(&$tree, $node_links = array()) {
  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.
    $nids = \Drupal::entityQuery('node')
      ->condition('nid', $nids, 'IN')
      ->condition('status', 1)
      ->execute();
 
    foreach ($nids as $nid) {
      foreach ($node_links[$nid] as $mlid => $link) {
        $node_links[$nid][$mlid]['access'] = TRUE;
      }
    }
  }
  $this->doBookTreeCheckAccess($tree);
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.