You are here

public function TermDuplicate::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/TermDuplicate.php, line 159

Class

TermDuplicate
Duplicate term.

Namespace

Drupal\commerce_bulk\Plugin\Action

Code

public function executeMultiple(array $terms) {
  if ($terms) {
    $ids = [];
    foreach ($terms as $term) {
      $ids[] = $term
        ->id();
    }
    $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();
  }
}