function DynamicPageCacheTestController::htmlUncacheableMaxAge

Same name in other branches
  1. 8.9.x core/modules/dynamic_page_cache/tests/dynamic_page_cache_test/src/DynamicPageCacheTestController.php \Drupal\dynamic_page_cache_test\DynamicPageCacheTestController::htmlUncacheableMaxAge()
  2. 10 core/modules/dynamic_page_cache/tests/dynamic_page_cache_test/src/DynamicPageCacheTestController.php \Drupal\dynamic_page_cache_test\DynamicPageCacheTestController::htmlUncacheableMaxAge()
  3. 11.x core/modules/dynamic_page_cache/tests/dynamic_page_cache_test/src/DynamicPageCacheTestController.php \Drupal\dynamic_page_cache_test\DynamicPageCacheTestController::htmlUncacheableMaxAge()

A route returning a render array (with max-age=0, so uncacheable)

Return value

array A render array.

See also

html()

1 string reference to 'DynamicPageCacheTestController::htmlUncacheableMaxAge'
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 87

Class

DynamicPageCacheTestController
Controller routines for dynamic_page_cache_test routes.

Namespace

Drupal\dynamic_page_cache_test

Code

public function htmlUncacheableMaxAge() {
    $build = $this->html();
    $build['very_dynamic_part'] = [
        '#markup' => 'Drupal cannot handle the awesomeness of llamas.',
        '#cache' => [
            'max-age' => 0,
        ],
    ];
    return $build;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.