protected function MediaImage::getItem in Varbase Media 9.0.x
Same name and namespace in other branches
- 8.7 modules/entity_browser_generic_embed/src/Plugin/entity_embed/EntityEmbedDisplay/MediaImage.php \Drupal\entity_browser_generic_embed\Plugin\entity_embed\EntityEmbedDisplay\MediaImage::getItem()
- 8.5 modules/entity_browser_generic_embed/src/Plugin/entity_embed/EntityEmbedDisplay/MediaImage.php \Drupal\entity_browser_generic_embed\Plugin\entity_embed\EntityEmbedDisplay\MediaImage::getItem()
- 8.6 modules/entity_browser_generic_embed/src/Plugin/entity_embed/EntityEmbedDisplay/MediaImage.php \Drupal\entity_browser_generic_embed\Plugin\entity_embed\EntityEmbedDisplay\MediaImage::getItem()
Returns the image field item to use for the embedded entity.
Return value
\Drupal\image\Plugin\Field\FieldType\ImageItem The image field item.
1 call to MediaImage::getItem()
- MediaImage::getAttributeValues in modules/
entity_browser_generic_embed/ src/ Plugin/ entity_embed/ EntityEmbedDisplay/ MediaImage.php
File
- modules/
entity_browser_generic_embed/ src/ Plugin/ entity_embed/ EntityEmbedDisplay/ MediaImage.php, line 99
Class
- MediaImage
- Renders a media item's image via the image formatter.
Namespace
Drupal\entity_browser_generic_embed\Plugin\entity_embed\EntityEmbedDisplayCode
protected function getItem() {
/** @var \Drupal\media\MediaInterface $entity */
$entity = $this
->getEntityFromContext();
$item = MediaHelper::getSourceField($entity)
->first();
return $item instanceof ImageItem ? $item : $entity
->get('thumbnail')
->first();
}