Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PlaceholderingRenderCache.php

function PlaceholderingRenderCache::get

Overrides RenderCache::get

File

core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php, line 91

Class

PlaceholderingRenderCache
Adds automatic placeholdering to the RenderCache.

Namespace

Drupal\Core\Render

Code

public function get(array $elements) {
    // When rendering placeholders, special case auto-placeholdered elements:
    // avoid retrieving them from cache again, or rendering them again.
    if (isset($elements['#create_placeholder']) && $elements['#create_placeholder'] === FALSE) {
        $cached_placeholder_result = $this->getFromPlaceholderResultsCache($elements);
        if ($cached_placeholder_result !== FALSE) {
            return $cached_placeholder_result;
        }
    }
    $cached_element = parent::get($elements);
    if ($cached_element === FALSE) {
        return FALSE;
    }
    else {
        if ($this->placeholderGenerator
            ->canCreatePlaceholder($elements) && $this->placeholderGenerator
            ->shouldAutomaticallyPlaceholder($cached_element)) {
            return $this->createPlaceholderAndRemember($cached_element, $elements);
        }
        return $cached_element;
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal