You are here

public function DropzoneJsEbWidget::submit in DropzoneJS 8

Same name and namespace in other branches
  1. 8.2 modules/eb_widget/src/Plugin/EntityBrowser/Widget/DropzoneJsEbWidget.php \Drupal\dropzonejs_eb_widget\Plugin\EntityBrowser\Widget\DropzoneJsEbWidget::submit()
1 method overrides DropzoneJsEbWidget::submit()
MediaEntityDropzoneJsEbWidget::submit in modules/eb_widget/src/Plugin/EntityBrowser/Widget/MediaEntityDropzoneJsEbWidget.php

File

modules/eb_widget/src/Plugin/EntityBrowser/Widget/DropzoneJsEbWidget.php, line 276

Class

DropzoneJsEbWidget
Provides an Entity Browser widget that uploads new files.

Namespace

Drupal\dropzonejs_eb_widget\Plugin\EntityBrowser\Widget

Code

public function submit(array &$element, array &$form, FormStateInterface $form_state) {
  $files = [];
  foreach ($this
    ->prepareEntities($form, $form_state) as $file) {
    $file
      ->setPermanent();
    $file
      ->save();
    $files[] = $file;
  }
  $this
    ->selectEntities($files, $form_state);
  $this
    ->clearFormValues($element, $form_state);
}