You are here

public function RenderStack::getRecursionStorage in Render cache 7.2

Returns the current recursion storage.

Return value

array The stored assets.

Overrides RenderStackInterface::getRecursionStorage

1 call to RenderStack::getRecursionStorage()
RenderStack::decreaseRecursion in src/Cache/RenderStack.php
Decrements the recursion level by 1.

File

src/Cache/RenderStack.php, line 110
Contains \Drupal\render_cache\Cache\RenderStack

Class

RenderStack
Defines the RenderStack service.

Namespace

Drupal\render_cache\Cache

Code

public function getRecursionStorage() {
  if (!isset($this->recursionStorage[$this->recursionLevel])) {
    $this->recursionStorage[$this->recursionLevel] = array();
  }
  $storage = $this->recursionStorage[$this->recursionLevel];
  $render = array();

  // Collect the new storage.
  if (!empty($storage)) {
    $render = $this
      ->collectAndRemoveAssets($storage);
    $attached = $this
      ->collectAttached($storage);
    if ($attached) {
      $render['#attached'] = $attached;
    }

    // Cache the work, no need to do it twice.
    $this->recursionStorage[$this->recursionLevel] = $render;
  }
  return $render;
}