You are here

public function DeleteFilesAction::executeMultiple in Fancy File Delete 2.0.x

Executes the plugin for an array of objects.

Parameters

array $objects: An array of entities.

Overrides ViewsBulkOperationsActionBase::executeMultiple

1 call to DeleteFilesAction::executeMultiple()
DeleteFilesAction::execute in src/Plugin/Action/DeleteFilesAction.php
Executes the plugin.
1 method overrides DeleteFilesAction::executeMultiple()
DeleteFilesActionForce::executeMultiple in src/Plugin/Action/DeleteFilesActionForce.php
Execute action on multiple entities.

File

src/Plugin/Action/DeleteFilesAction.php, line 61

Class

DeleteFilesAction
Deletes Files.

Namespace

Drupal\fancy_file_delete\Plugin\Action

Code

public function executeMultiple(array $entities) {

  // Set entities to batch our way.
  $values = [];
  foreach ($entities as $entity) {
    if ($entity instanceof UnmanagedFiles) {
      $values[] = $entity
        ->getPath();
    }
    elseif ($entity instanceof File) {
      $values[] = $entity
        ->id();
    }
  }

  // Send to batch.
  $this->batch
    ->setBatch($values, FALSE);
}