function DynamicPageCacheSubscriber::renderArrayToResponse

Same name in other branches
  1. 9 core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php \Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber::renderArrayToResponse()

Gets the embedded Response object in a render array.

Parameters

array $render_array: A render array with a #response property.

Return value

\Drupal\Core\Cache\CacheableResponseInterface The cacheable response object.

See also

responseToRenderArray()

1 call to DynamicPageCacheSubscriber::renderArrayToResponse()
DynamicPageCacheSubscriber::onRequest in core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php
Sets a response in case of a Dynamic Page Cache hit.

File

core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php, line 300

Class

DynamicPageCacheSubscriber
Returns cached responses as early and avoiding as much work as possible.

Namespace

Drupal\dynamic_page_cache\EventSubscriber

Code

protected function renderArrayToResponse(array $render_array) {
    return $render_array['#response'];
}

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