public function BrightcoveVideo::prepareFormDisplay 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::prepareFormDisplay()
Prepares the media type fields for this source in the form 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 form display.
Parameters
\Drupal\media\MediaTypeInterface $type: The media type which is using this source.
\Drupal\Core\Entity\Display\EntityFormDisplayInterface $display: The display which should be prepared.
Overrides MediaSourceBase::prepareFormDisplay
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 145
Class
- BrightcoveVideo
- Brightcove Video entity media source.
Namespace
Drupal\media_brightcove\Plugin\media\SourceCode
public function prepareFormDisplay(MediaTypeInterface $type, EntityFormDisplayInterface $display) {
// Let the parent add the defaults.
parent::prepareFormDisplay($type, $display);
// Change only what's needed.
$component = $display
->getComponent($this
->getSourceFieldDefinition($type)
->getName());
$component['type'] = 'brightcove_inline_entity_form_complex';
$component['settings'] = [
'form_mode' => 'default',
'allow_new' => 1,
'allow_existing' => 1,
'match_operator' => 'CONTAINS',
];
$display
->setComponent($this
->getSourceFieldDefinition($type)
->getName(), $component);
}