summaryrefslogtreecommitdiffstats
path: root/core/modules/book/tests/modules/book_test/book_test.module
blob: 91da82c28923010a93585dacb67ecf3386ab62d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php

/**
 * @file
 * Test module for testing the book module.
 *
 * This module's functionality depends on the following state variables:
 * - book_test.debug_book_navigation_cache_context: Used in NodeQueryAlterTest to enable the
 *   node_access_all grant realm.
 *
 * @see \Drupal\book\Tests\BookTest::testBookNavigationCacheContext()
 */

/**
 * Implements hook_page_attachments().
 */
function book_test_page_attachments(array &$page) {
  $page['#cache']['tags'][] = 'book_test.debug_book_navigation_cache_context';
  if (\Drupal::state()->get('book_test.debug_book_navigation_cache_context', FALSE)) {
    \Drupal::messenger()->addStatus(\Drupal::service('cache_contexts_manager')->convertTokensToKeys(['route.book_navigation'])->getKeys()[0]);
  }
}