You are here

public function AudioStream::prepareViewDisplay in Media entity audio 8.3

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

src/Plugin/media/Source/AudioStream.php, line 54

Class

AudioStream
Provides media type plugin for Audio.

Namespace

Drupal\media_entity_audio\Plugin\media\Source

Code

public function prepareViewDisplay(MediaTypeInterface $type, EntityViewDisplayInterface $display) {
  $display
    ->setComponent($this
    ->getSourceFieldDefinition($type)
    ->getName(), [
    'type' => 'audio_stream_html5',
    'label' => 'visually_hidden',
  ]);
}