You are here

public function Instagram::prepareViewDisplay in Media entity Instagram 3.x

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 OEmbed::prepareViewDisplay

See also

\Drupal\Core\Entity\Display\EntityDisplayInterface::setComponent()

\Drupal\Core\Entity\Display\EntityDisplayInterface::removeComponent()

File

src/Plugin/media/Source/Instagram.php, line 119

Class

Instagram
Implementation of an oEmbed Instagram source.

Namespace

Drupal\media_entity_instagram\Plugin\media\Source

Code

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