function FileFormatterBase::needsEntityLoad

Same name in other branches
  1. 9 core/modules/file/src/Plugin/Field/FieldFormatter/FileFormatterBase.php \Drupal\file\Plugin\Field\FieldFormatter\FileFormatterBase::needsEntityLoad()
  2. 8.9.x core/modules/file/src/Plugin/Field/FieldFormatter/FileFormatterBase.php \Drupal\file\Plugin\Field\FieldFormatter\FileFormatterBase::needsEntityLoad()
  3. 10 core/modules/file/src/Plugin/Field/FieldFormatter/FileFormatterBase.php \Drupal\file\Plugin\Field\FieldFormatter\FileFormatterBase::needsEntityLoad()

Overrides EntityReferenceFormatterBase::needsEntityLoad

1 method overrides FileFormatterBase::needsEntityLoad()
MediaThumbnailFormatter::needsEntityLoad in core/modules/media/src/Plugin/Field/FieldFormatter/MediaThumbnailFormatter.php
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.

File

core/modules/file/src/Plugin/Field/FieldFormatter/FileFormatterBase.php, line 18

Class

FileFormatterBase
Base class for file formatters.

Namespace

Drupal\file\Plugin\Field\FieldFormatter

Code

protected function needsEntityLoad(EntityReferenceItem $item) {
    return parent::needsEntityLoad($item) && $item->isDisplayed();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.