public function AudioFile::prepareViewDisplay in Drupal 10
Same name and namespace in other branches
- 8 core/modules/media/src/Plugin/media/Source/AudioFile.php \Drupal\media\Plugin\media\Source\AudioFile::prepareViewDisplay()
- 9 core/modules/media/src/Plugin/media/Source/AudioFile.php \Drupal\media\Plugin\media\Source\AudioFile::prepareViewDisplay()
Prepares the media type fields for this source in the view display.
This method should normally call \Drupal\Core\Entity\Display\EntityDisplayInterface::setComponent() or \Drupal\Core\Entity\Display\EntityDisplayInterface::removeComponent() to configure the media type fields in the view display.
Parameters
\Drupal\media\MediaTypeInterface $type: The media type which is using this source.
\Drupal\Core\Entity\Display\EntityViewDisplayInterface $display: The display which should be prepared.
Overrides MediaSourceBase::prepareViewDisplay
See also
\Drupal\Core\Entity\Display\EntityDisplayInterface::setComponent()
\Drupal\Core\Entity\Display\EntityDisplayInterface::removeComponent()
File
- core/
modules/ media/ src/ Plugin/ media/ Source/ AudioFile.php, line 33
Class
- AudioFile
- Media source wrapping around an audio file.
Namespace
Drupal\media\Plugin\media\SourceCode
public function prepareViewDisplay(MediaTypeInterface $type, EntityViewDisplayInterface $display) {
$display
->setComponent($this
->getSourceFieldDefinition($type)
->getName(), [
'type' => 'file_audio',
'label' => 'visually_hidden',
]);
}