Commit d7787040 authored by John Voskuilen's avatar John Voskuilen
Browse files

Issue #2767779: Fix Field Caching for formatter - fix cache-tags

parent cdbca0cd
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -415,11 +415,11 @@ abstract class OfficeHoursFormatterBase extends FormatterBase {

    $max_age = $items->getCacheTime($settings, $this->getFieldSettings());
    if ($max_age !== Cache::PERMANENT) {
      // $cache_tags = $field_definition->getTargetEntityTypeId();
      $cache_tags = $field_definition->id();
      $entity = $items->getEntity();

      $cache_tags = $entity->getEntityTypeId() . ':' . $entity->id();
      $elements['#cache'] = [
        'max-age' => $items->getCacheTime($settings, $this->getFieldSettings()),
        // @todo Add per-entity tags 'thing:identifier'.
        // @see https://www.drupal.org/docs/drupal-apis/cache-api/cache-tags
        'tags' => [$cache_tags],
      ];