book_test.module 746 B

12345678910111213141516171819202122
  1. <?php
  2. /**
  3. * @file
  4. * Test module for testing the book module.
  5. *
  6. * This module's functionality depends on the following state variables:
  7. * - book_test.debug_book_navigation_cache_context: Used in NodeQueryAlterTest to enable the
  8. * node_access_all grant realm.
  9. *
  10. * @see \Drupal\book\Tests\BookTest::testBookNavigationCacheContext()
  11. */
  12. /**
  13. * Implements hook_page_attachments().
  14. */
  15. function book_test_page_attachments(array &$page) {
  16. $page['#cache']['tags'][] = 'book_test.debug_book_navigation_cache_context';
  17. if (\Drupal::state()->get('book_test.debug_book_navigation_cache_context', FALSE)) {
  18. drupal_set_message(\Drupal::service('cache_contexts_manager')->convertTokensToKeys(['route.book_navigation'])->getKeys()[0]);
  19. }
  20. }