You are here

protected function MediaThumbnailFormatter::needsEntityLoad in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/media/src/Plugin/Field/FieldFormatter/MediaThumbnailFormatter.php \Drupal\media\Plugin\Field\FieldFormatter\MediaThumbnailFormatter::needsEntityLoad()

This has to be overridden because FileFormatterBase expects $item to be of type \Drupal\file\Plugin\Field\FieldType\FileItem and calls isDisplayed() which is not in FieldItemInterface.

Overrides FileFormatterBase::needsEntityLoad

File

core/modules/media/src/Plugin/Field/FieldFormatter/MediaThumbnailFormatter.php, line 91

Class

MediaThumbnailFormatter
Plugin implementation of the 'media_thumbnail' formatter.

Namespace

Drupal\media\Plugin\Field\FieldFormatter

Code

protected function needsEntityLoad(EntityReferenceItem $item) {
  return !$item
    ->hasNewEntity();
}