You are here

public function MediaVideoAdd::submit in Panopoly 8.2

File

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

Class

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

Namespace

Drupal\panopoly_media\Plugin\EntityBrowser\Widget

Code

public function submit(array &$element, array &$form, FormStateInterface $form_state) {
  if (!empty($form_state
    ->getTriggeringElement()['#eb_widget_main_submit'])) {
    $videos = $this
      ->prepareEntities($form, $form_state);
    array_walk($videos, function (MediaInterface $media) {
      $media
        ->save();
    });
    $this
      ->selectEntities($videos, $form_state);
  }
}