You are here

public function MediaVideoAdd::getForm in Panopoly 8.2

File

modules/panopoly/panopoly_media/src/Plugin/EntityBrowser/Widget/MediaVideoAdd.php, line 34

Class

MediaVideoAdd
Uses a view to provide entity listing in a browser's widget.

Namespace

Drupal\panopoly_media\Plugin\EntityBrowser\Widget

Code

public function getForm(array &$original_form, FormStateInterface $form_state, array $additional_widget_parameters) {
  $form = parent::getForm($original_form, $form_state, $additional_widget_parameters);
  $form_display = \Drupal::service('entity_display.repository')
    ->getFormDisplay('media', $this->configuration['media_type'], 'entity_browser');
  $media = $this->entityTypeManager
    ->getStorage('media')
    ->create([
    'bundle' => $this->configuration['media_type'],
  ]);
  $form_display
    ->buildForm($media, $form, $form_state);
  return $form;
}