You are here

public function VariationDuplicate::executeMultiple in Commerce Bulk 8

Executes the plugin for an array of objects.

Parameters

array $objects: An array of entities.

Overrides ActionBase::executeMultiple

File

src/Plugin/Action/VariationDuplicate.php, line 175

Class

VariationDuplicate
Duplicate variation.

Namespace

Drupal\commerce_bulk\Plugin\Action

Code

public function executeMultiple(array $variations) {
  if ($variations) {
    $variation = end($variations);
    $url = $variation
      ->toUrl();
    $query = [
      'destination' => \Drupal::request()
        ->getRequestUri(),
      'id' => $variation
        ->id(),
    ];
    $path = $url::fromUserInput('/admin/config/system/actions/configure/' . $this
      ->getPluginId(), [
      'query' => $query,
    ])
      ->toString();
    $response = new RedirectResponse($path);
    $response
      ->send();
  }
}