You are here

protected function ParagraphsTableFormatter::cacheMetadata in Paragraphs table 8

Cache.

2 calls to ParagraphsTableFormatter::cacheMetadata()
ParagraphsTableFormatter::getTable in src/Plugin/Field/FieldFormatter/ParagraphsTableFormatter.php
ParagraphsTableFormatter::getTableVertical in src/Plugin/Field/FieldFormatter/ParagraphsTableFormatter.php

File

src/Plugin/Field/FieldFormatter/ParagraphsTableFormatter.php, line 656

Class

ParagraphsTableFormatter
Plugin implementation of the 'paragraphs_table_formatter' formatter.

Namespace

Drupal\paragraphs_table\Plugin\Field\FieldFormatter

Code

protected function cacheMetadata($entities, &$table) {
  $cache_metadata = new CacheableMetadata();
  foreach ($entities as $entity) {
    $cache_metadata
      ->addCacheableDependency($entity);
    $cache_metadata
      ->addCacheableDependency($entity
      ->access('view', NULL, TRUE));
  }
  $cache_metadata
    ->applyTo($table);
}