public function BrightcoveVideo::prepareViewDisplay in Brightcove Video Connect 8.2
Same name and namespace in other branches
- 3.x modules/media_brightcove/src/Plugin/media/Source/BrightcoveVideo.php \Drupal\media_brightcove\Plugin\media\Source\BrightcoveVideo::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
- modules/
media_brightcove/ src/ Plugin/ media/ Source/ BrightcoveVideo.php, line 163
Class
- BrightcoveVideo
- Brightcove Video entity media source.
Namespace
Drupal\media_brightcove\Plugin\media\SourceCode
public function prepareViewDisplay(MediaTypeInterface $type, EntityViewDisplayInterface $display) {
// Let the parent add the defaults.
parent::prepareViewDisplay($type, $display);
// Change only what's needed.
$component = $display
->getComponent($this
->getSourceFieldDefinition($type)
->getName());
$component['label'] = 'hidden';
$component['settings']['link'] = TRUE;
$component['type'] = 'entity_reference_entity_view';
$display
->setComponent($this
->getSourceFieldDefinition($type)
->getName(), $component);
}