public function MediaImage::getFieldDefinition in Lightning Media 8
Same name and namespace in other branches
- 8.4 src/Plugin/entity_embed/EntityEmbedDisplay/MediaImage.php \Drupal\lightning_media\Plugin\entity_embed\EntityEmbedDisplay\MediaImage::getFieldDefinition()
- 8.2 src/Plugin/entity_embed/EntityEmbedDisplay/MediaImage.php \Drupal\lightning_media\Plugin\entity_embed\EntityEmbedDisplay\MediaImage::getFieldDefinition()
- 8.3 src/Plugin/entity_embed/EntityEmbedDisplay/MediaImage.php \Drupal\lightning_media\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
- src/
Plugin/ entity_embed/ EntityEmbedDisplay/ MediaImage.php, line 76
Class
- MediaImage
- Renders a media item's image via the image formatter.
Namespace
Drupal\lightning_media\Plugin\entity_embed\EntityEmbedDisplayCode
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');
}