You are here

public static function BynderUpload::batchFinish in Bynder 4.0.x

Same name and namespace in other branches
  1. 8.3 src/Plugin/EntityBrowser/Widget/BynderUpload.php \Drupal\bynder\Plugin\EntityBrowser\Widget\BynderUpload::batchFinish()
  2. 8 src/Plugin/EntityBrowser/Widget/BynderUpload.php \Drupal\bynder\Plugin\EntityBrowser\Widget\BynderUpload::batchFinish()
  3. 8.2 src/Plugin/EntityBrowser/Widget/BynderUpload.php \Drupal\bynder\Plugin\EntityBrowser\Widget\BynderUpload::batchFinish()

Upload batch finish callback.

Stores results (media entities) into the session for the form to be able to pick them up.

File

src/Plugin/EntityBrowser/Widget/BynderUpload.php, line 411

Class

BynderUpload
Uses upload to create media entities.

Namespace

Drupal\bynder\Plugin\EntityBrowser\Widget

Code

public static function batchFinish($success, $results, $operations) {
  if (\Drupal::service('session')
    ->get('upload_permissions', FALSE) != 'MEDIAUPLOADFORAPPROVAL') {
    unset($results['accessRequestId']);

    // Save results into the form state to make them available in the form.
    \Drupal::service('session')
      ->set('bynder_upload_batch_result', $results);
  }
}