3 namespace Drupal\entity_test\Plugin\Field\FieldFormatter;
5 use Drupal\Core\Field\FieldItemListInterface;
6 use Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase;
9 * Plugin implementation of the 'entity_reference_custom_cache_tag' formatter.
12 * id = "entity_reference_custom_cache_tag",
13 * label = @Translation("Custom cache tag"),
19 class EntityTestReferenceCustomCacheTagFormatter extends EntityReferenceFormatterBase {
24 public function viewElements(FieldItemListInterface $items, $langcode) {
25 return ['#cache' => ['tags' => ['custom_cache_tag']]];