function ResourceObjectNormalizationCacher::generateLookupRenderArray

Same name and namespace in other branches
  1. 8.9.x core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php \Drupal\jsonapi\EventSubscriber\ResourceObjectNormalizationCacher::generateLookupRenderArray()

Generates a lookup render array for a normalization.

Parameters

\Drupal\jsonapi\JsonApiResource\ResourceObject $object: The resource object for which to generate a cache item.

Return value

array A render array for use with the RenderCache service.

See also

\Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber::$dynamicPageCacheRedirectRenderArray

2 calls to ResourceObjectNormalizationCacher::generateLookupRenderArray()
ResourceObjectNormalizationCacher::get in core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php
Reads an entity normalization from cache.
ResourceObjectNormalizationCacher::set in core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php
Writes a normalization to cache.

File

core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php, line 164

Class

ResourceObjectNormalizationCacher
Caches entity normalizations after the response has been sent.

Namespace

Drupal\jsonapi\EventSubscriber

Code

protected static function generateLookupRenderArray(ResourceObject $object) {
  return [
    '#cache' => [
      'keys' => [
        $object->getResourceType()
          ->getTypeName(),
        $object->getId(),
        $object->getLanguage()
          ->getId(),
      ],
      'bin' => 'jsonapi_normalizations',
    ],
  ];
}

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