You are here

public function BulkCloneProduct::executeMultiple in Entity Bulk Clone 8

Executes the plugin for an array of objects.

Parameters

array $objects: An array of entities.

Overrides ActionBase::executeMultiple

File

src/Plugin/Action/BulkCloneProduct.php, line 23

Class

BulkCloneProduct
Entity Bulk clone of commerce product.

Namespace

Drupal\entity_bulk_clone\Plugin\Action

Code

public function executeMultiple(array $objects) {
  $results = [];
  foreach ($objects as $entity) {
    $results[] = $this
      ->execute($entity);
  }
  if (isset($results) && !empty($results)) {
    $batch = [
      'title' => $this
        ->t('Product Bulk Cloning...'),
      'operations' => $results,
      'finished' => '\\Drupal\\entity_bulk_clone\\Plugin\\BulkCloneProduct::batchFinished',
    ];
    batch_set($batch);
  }
}