Commit 12423e48 authored by John Voskuilen's avatar John Voskuilen
Browse files

Issue #2767779: Fix Field Caching for formatter - third_party_settings

parent d7787040
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -410,16 +410,16 @@ abstract class OfficeHoursFormatterBase extends FormatterBase {
   *   The list of formatters.
   */
  protected function addCacheMaxAge(OfficeHoursItemListInterface $items, array &$elements) {
    $field_definition = $items->getFieldDefinition();
    $settings = $this->getSettings();
    $third_party_settings = $this->getThirdPartySettings();

    $max_age = $items->getCacheTime($settings, $this->getFieldSettings());
    $max_age = $items->getCacheTime($settings, $this->getFieldSettings(), $third_party_settings);
    if ($max_age !== Cache::PERMANENT) {
      $entity = $items->getEntity();

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