You are here

protected function PageController::render in Render cache 7.2

Render uncached objects.

This function needs to be implemented by every child class.

Parameters

array $objects: Array of $objects to be rendered keyed by id.

Return value

array Render array keyed by id.

Overrides AbstractBaseController::render

File

modules/controller/render_cache_page/src/RenderCache/Controller/PageController.php, line 109
Contains \Drupal\render_cache_page\RenderCache\Controller\PageController

Class

PageController
PageController - Provides render caching for page objects.

Namespace

Drupal\render_cache_page\RenderCache\Controller

Code

protected function render(array $objects) {
  foreach ($objects as $id => $page) {
    if ($this->renderStack
      ->supportsDynamicAssets()) {
      $storage = $page->content['x_render_cache_page_recursion_storage'];
      unset($page->content['x_render_cache_page_recursion_storage']);
      $this->renderStack
        ->addRecursionStorage($storage, TRUE);
    }
    $build[$id] = render_cache_page_drupal_render_page_helper($page->content);
  }

  // @see drupal_pre_render_page() in Drupal 8.
  global $theme;
  $page_id = current(array_keys($objects));
  $build[$page_id]['#cache']['tags'][] = 'theme:' . $theme;
  return $build;
}