You are here

protected static function ResourceObjectNormalizationCacher::generateLookupRenderArray in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/src/EventSubscriber/ResourceObjectNormalizationCacher.php \Drupal\jsonapi\EventSubscriber\ResourceObjectNormalizationCacher::generateLookupRenderArray()
  2. 9 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

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',
    ],
  ];
}