You are here

interface RenderStackInterface in Render cache 7.2

Defines an interface for a render stack.

Hierarchy

Expanded class hierarchy of RenderStackInterface

All classes that implement RenderStackInterface

1 file declares its use of RenderStackInterface
BaseController.php in src/RenderCache/Controller/BaseController.php
Contains \Drupal\render_cache\RenderCache\Controller\BaseController

File

src/Cache/RenderStackInterface.php, line 14
Contains \Drupal\render_cache\Cache\RenderStackInterface

Namespace

Drupal\render_cache\Cache
View source
interface RenderStackInterface {

  /**
   * Renders the given render array, but preserves Drupal 8 properties
   * in the stack.
   *
   * @param array $render
   *   The render array to render.
   *
   * @return string
   *   The rendered render array.
   */
  public function drupalRender(array &$render);

  /**
   * Increments the recursion level by 1.
   */
  public function increaseRecursion();

  /**
   * Decrements the recursion level by 1.
   *
   * @return array
   *   Returns the current recursion storage with the assets.
   */
  public function decreaseRecursion();

  /**
   * Whether we are in a recursive context.
   *
   * This is useful to determine e.g. if its safe to output a placeholder.
   *
   * @return bool
   *   TRUE if its recursive, FALSE otherwise.
   */
  public function isRecursive();

  /**
   * Returns the current recursion level.
   *
   * @return int
   *   The current recursion level.
   */
  public function getRecursionLevel();

  /**
   * Returns the current recursion storage.
   *
   * @return array
   *   The stored assets.
   */
  public function getRecursionStorage();

  /**
   * Sets the current recursion storage, overwriting everything that is
   * already stored in the current stack frame.
   *
   * @param array $storage
   *   The assets to store in the current stack frame.
   */
  public function setRecursionStorage(array $storage);

  /**
   * Adds assets to the current stack frame and removes them from the
   * render array.
   *
   * @param array $render
   *   The render array to retrieve and remove the assets from.
   * @param bool $collect_attached
   *   Whether or not #attached assets should be collected.
   */
  public function addRecursionStorage(array &$render, $collect_attached = FALSE);

  // Render Cache specific functions.
  // --------------------------------

  /**
   * Converts a render array to be compatible with Drupal 7.
   *
   * This moves Drupal 8 properties into ['#attached']['render_cache'].
   *
   * @param array $render
   *   The render array to convert.
   * @return array
   *   The converted render array.
   */
  public function convertRenderArrayToD7($render);

  /**
   * Converts a render array back to be compatible with Drupal 8.
   *
   * This moves properties from ['#attached']['render_cache'] back to the root.
   *
   * @param array $render
   *   The render array to convert.
   * @return array
   *   The converted render array.
   */
  public function convertRenderArrayFromD7($render);

}

Members

Namesort descending Modifiers Type Description Overrides
RenderStackInterface::addRecursionStorage public function Adds assets to the current stack frame and removes them from the render array. 1
RenderStackInterface::convertRenderArrayFromD7 public function Converts a render array back to be compatible with Drupal 8. 1
RenderStackInterface::convertRenderArrayToD7 public function Converts a render array to be compatible with Drupal 7. 1
RenderStackInterface::decreaseRecursion public function Decrements the recursion level by 1. 1
RenderStackInterface::drupalRender public function Renders the given render array, but preserves Drupal 8 properties in the stack. 1
RenderStackInterface::getRecursionLevel public function Returns the current recursion level. 1
RenderStackInterface::getRecursionStorage public function Returns the current recursion storage. 1
RenderStackInterface::increaseRecursion public function Increments the recursion level by 1. 1
RenderStackInterface::isRecursive public function Whether we are in a recursive context. 1
RenderStackInterface::setRecursionStorage public function Sets the current recursion storage, overwriting everything that is already stored in the current stack frame. 1