Last active
April 26, 2021 13:11
-
-
Save omahm/cd990b5cdba637fe270ada0702717d9d to your computer and use it in GitHub Desktop.
Patch to enable cached Ajax responses.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/core/lib/Drupal/Core/Cache/CacheableAjaxResponse.php b/core/lib/Drupal/Core/Cache/CacheableAjaxResponse.php | |
new file mode 100644 | |
index 0000000000..996e674d8e | |
--- /dev/null | |
+++ b/core/lib/Drupal/Core/Cache/CacheableAjaxResponse.php | |
@@ -0,0 +1,21 @@ | |
+<?php | |
+ | |
+namespace Drupal\Core\Cache; | |
+ | |
+use Drupal\Core\Ajax\AjaxResponse; | |
+ | |
+/** | |
+ * A AjaxResponse that contains and can expose cacheability metadata. | |
+ * | |
+ * Supports Drupal's caching concepts: cache tags for invalidation and cache | |
+ * contexts for variations. | |
+ * | |
+ * @see \Drupal\Core\Cache\Cache | |
+ * @see \Drupal\Core\Cache\CacheableMetadata | |
+ * @see \Drupal\Core\Cache\CacheableResponseTrait | |
+ */ | |
+class CacheableAjaxResponse extends AjaxResponse implements CacheableResponseInterface { | |
+ | |
+ use CacheableResponseTrait; | |
+ | |
+} | |
+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment