You are here

public function VariationXquantityStockSet::executeMultiple in Commerce Extended Quantity 8

Executes the plugin for an array of objects.

Parameters

array $objects: An array of entities.

Overrides ActionBase::executeMultiple

File

modules/xquantity_stock/src/Plugin/Action/VariationXquantityStockSet.php, line 103

Class

VariationXquantityStockSet
Set variation stock.

Namespace

Drupal\xquantity_stock\Plugin\Action

Code

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