You are here

protected function MediaVideoAdd::prepareEntities in Panopoly 8.2

1 call to MediaVideoAdd::prepareEntities()
MediaVideoAdd::submit in modules/panopoly/panopoly_media/src/Plugin/EntityBrowser/Widget/MediaVideoAdd.php

File

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

Class

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

Namespace

Drupal\panopoly_media\Plugin\EntityBrowser\Widget

Code

protected function prepareEntities(array $form, FormStateInterface $form_state) {
  $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
    ->extractFormValues($media, $form, $form_state);
  return [
    $media,
  ];
}