.../src/EventSubscriber/DynamicPageCacheSubscriber.php | 2 +- core/modules/filter/filter.routing.yml | 3 +++ .../tests/modules/ajax_test/src/Controller/AjaxTestController.php | 3 +++ .../system/tests/modules/test_page_test/src/Controller/Test.php | 3 +++ .../modules/test_page_test/src/Controller/TestPageTestController.php | 1 + 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php b/core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php index 792d0cd..35087b1 100644 --- a/core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php +++ b/core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php @@ -184,7 +184,7 @@ public function onViewRenderArray(GetResponseForControllerResultEvent $event) { if (is_array($result) && ($request->query->has(MainContentViewSubscriber::WRAPPER_FORMAT) || $request->getRequestFormat() == 'html')) { // If #cache is not set, complain. if (!isset($result['#cache'])) { - throw new \LogicException('Controllers must provide cacheability metadata.'); + throw new \LogicException('The controller returned a render array without cacheability metadata. See https://www.drupal.org/developing/api/8/render/arrays/cacheability.'); } } } diff --git a/core/modules/filter/filter.routing.yml b/core/modules/filter/filter.routing.yml index 5b56da7..0724195 100644 --- a/core/modules/filter/filter.routing.yml +++ b/core/modules/filter/filter.routing.yml @@ -13,6 +13,9 @@ filter.tips: _title: 'Compose tips' requirements: _entity_access: 'filter_format.use' + options: + # @todo Add cacheability metadata to this response. + no_cache: TRUE filter.admin_overview: path: '/admin/config/content/formats' diff --git a/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php b/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php index ff4859d..7501914 100644 --- a/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php +++ b/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php @@ -28,6 +28,7 @@ class AjaxTestController { public static function dialogContents() { // This is a regular render array; the keys do not have special meaning. $content = array( + '#cache' => [], '#title' => 'AJAX Dialog contents', 'content' => array( '#markup' => 'Example message', @@ -56,6 +57,7 @@ public static function dialogContents() { */ public function render() { return [ + '#cache' => [], '#attached' => [ 'library' => [ 'core/drupalSettings', @@ -106,6 +108,7 @@ public function renderError(Request $request) { * Returns a render array of form elements and links for dialog. */ public function dialog() { + $build['#cache'] = []; // Add two wrapper elements for testing non-modal dialogs. Modal dialogs use // the global drupal-modal wrapper by default. $build['dialog_wrappers'] = array('#markup' => '
'); diff --git a/core/modules/system/tests/modules/test_page_test/src/Controller/Test.php b/core/modules/system/tests/modules/test_page_test/src/Controller/Test.php index 934e6a2..3b330ec 100644 --- a/core/modules/system/tests/modules/test_page_test/src/Controller/Test.php +++ b/core/modules/system/tests/modules/test_page_test/src/Controller/Test.php @@ -24,6 +24,7 @@ public function renderTitle() { $build = array(); $build['#markup'] = 'Hello Drupal'; $build['#title'] = 'Foo'; + $build['#cache'] = []; return $build; } @@ -37,6 +38,7 @@ public function renderTitle() { public function staticTitle() { $build = array(); $build['#markup'] = 'Hello Drupal'; + $build['#cache'] = []; return $build; } @@ -74,6 +76,7 @@ public function controllerWithCache() { public function renderPage() { return array( '#markup' => 'Content', + '#cache' => [], ); } diff --git a/core/modules/system/tests/modules/test_page_test/src/Controller/TestPageTestController.php b/core/modules/system/tests/modules/test_page_test/src/Controller/TestPageTestController.php index ca423c8..552dab8 100644 --- a/core/modules/system/tests/modules/test_page_test/src/Controller/TestPageTestController.php +++ b/core/modules/system/tests/modules/test_page_test/src/Controller/TestPageTestController.php @@ -24,6 +24,7 @@ public function testPage() { 'test-setting' => 'azAZ09();.,\\\/-_{}', ], ], + '#cache' => [], ]; }