You are here

public function EntityDeleteController::getEntitiesDeleteBatch in Delete all 8

Same name and namespace in other branches
  1. 2.x src/Controller/EntityDeleteController.php \Drupal\delete_all\Controller\EntityDeleteController::getEntitiesDeleteBatch()

File

src/Controller/EntityDeleteController.php, line 51

Class

EntityDeleteController
Returns responses for devel module routes.

Namespace

Drupal\delete_all\Controller

Code

public function getEntitiesDeleteBatch($entities_to_delete = FALSE, $entity_type) {

  // Define batch.
  $batch = [
    'operations' => [
      [
        'delete_all_entities_batch_delete',
        [
          $entities_to_delete,
          $entity_type,
        ],
      ],
    ],
    'finished' => 'delete_all_entities_batch_delete_finished',
    'title' => $this
      ->t('Deleting entities'),
    'init_message' => $this
      ->t('Entity deletion is starting.'),
    'progress_message' => $this
      ->t('Deleting entities...'),
    'error_message' => $this
      ->t('Entity deletion has encountered an error.'),
  ];
  return $batch;
}