public function MediaImage::getAttributeValues 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::getAttributeValues()
- 8.5 modules/entity_browser_generic_embed/src/Plugin/entity_embed/EntityEmbedDisplay/MediaImage.php \Drupal\entity_browser_generic_embed\Plugin\entity_embed\EntityEmbedDisplay\MediaImage::getAttributeValues()
- 8.6 modules/entity_browser_generic_embed/src/Plugin/entity_embed/EntityEmbedDisplay/MediaImage.php \Drupal\entity_browser_generic_embed\Plugin\entity_embed\EntityEmbedDisplay\MediaImage::getAttributeValues()
File
- modules/
entity_browser_generic_embed/ src/ Plugin/ entity_embed/ EntityEmbedDisplay/ MediaImage.php, line 50
Class
- MediaImage
- Renders a media item's image via the image formatter.
Namespace
Drupal\entity_browser_generic_embed\Plugin\entity_embed\EntityEmbedDisplayCode
public function getAttributeValues() {
$field = $this
->getItem();
$label = $field
->getEntity()
->label();
// Try to default to the alt and title attributes set on the field item, but
// fall back to the entity label for both.
return parent::getAttributeValues() + [
'alt' => $field->alt ?: $label,
'title' => $field->title ?: $label,
];
}