public function DynamicPageCacheTestController::cacheableResponse in Drupal 9
Same name and namespace in other branches
- 8 core/modules/dynamic_page_cache/tests/dynamic_page_cache_test/src/DynamicPageCacheTestController.php \Drupal\dynamic_page_cache_test\DynamicPageCacheTestController::cacheableResponse()
A route returning a CacheableResponse object.
Return value
\Drupal\Core\Cache\CacheableResponseInterface A CacheableResponseInterface object.
1 string reference to 'DynamicPageCacheTestController::cacheableResponse'
- dynamic_page_cache_test.routing.yml in core/
modules/ dynamic_page_cache/ tests/ dynamic_page_cache_test/ dynamic_page_cache_test.routing.yml - core/modules/dynamic_page_cache/tests/dynamic_page_cache_test/dynamic_page_cache_test.routing.yml
File
- core/
modules/ dynamic_page_cache/ tests/ dynamic_page_cache_test/ src/ DynamicPageCacheTestController.php, line 34
Class
- DynamicPageCacheTestController
- Controller routines for dynamic_page_cache_test routes.
Namespace
Drupal\dynamic_page_cache_testCode
public function cacheableResponse() {
$user = User::load(1);
$response = new CacheableResponse($user
->label());
$response
->addCacheableDependency($user);
return $response;
}