You are here

public function MediaImage::getFieldDefinition in Varbase Media 8.5

Same name and namespace in other branches
  1. 8.7 modules/entity_browser_generic_embed/src/Plugin/entity_embed/EntityEmbedDisplay/MediaImage.php \Drupal\entity_browser_generic_embed\Plugin\entity_embed\EntityEmbedDisplay\MediaImage::getFieldDefinition()
  2. 8.6 modules/entity_browser_generic_embed/src/Plugin/entity_embed/EntityEmbedDisplay/MediaImage.php \Drupal\entity_browser_generic_embed\Plugin\entity_embed\EntityEmbedDisplay\MediaImage::getFieldDefinition()
  3. 9.0.x modules/entity_browser_generic_embed/src/Plugin/entity_embed/EntityEmbedDisplay/MediaImage.php \Drupal\entity_browser_generic_embed\Plugin\entity_embed\EntityEmbedDisplay\MediaImage::getFieldDefinition()

Get the FieldDefinition object required to render this field's formatter.

Return value

\Drupal\Core\Field\BaseFieldDefinition The field definition.

Overrides EntityReferenceFieldFormatter::getFieldDefinition

See also

\Drupal\entity_embed\FieldFormatterEntityEmbedDisplayBase::build()

File

modules/entity_browser_generic_embed/src/Plugin/entity_embed/EntityEmbedDisplay/MediaImage.php, line 76

Class

MediaImage
Renders a media item's image via the image formatter.

Namespace

Drupal\entity_browser_generic_embed\Plugin\entity_embed\EntityEmbedDisplay

Code

public function getFieldDefinition() {

  // The parent method will set the target_type to the entity type being
  // embedded, but we are actually rendering an image (i.e., a file entity).
  return parent::getFieldDefinition()
    ->setSetting('target_type', 'file');
}