You are here

public static function DeleteEntity::deleteEntityFinishedCallback in Entity Delete 8

Entity Delete Callback.

Parameters

string $success: Return message on success.

int $results: Giving the total count of contents deleted.

string $operations: Delete operation.

File

src/DeleteEntity.php, line 44

Class

DeleteEntity
Service for Deleting the entity.

Namespace

Drupal\entity_delete

Code

public static function deleteEntityFinishedCallback($success, $results, $operations) {
  if ($success) {
    if ($results['bundle'] == 'all') {
      $message = t('Successfully deleted @num @entity(s).', [
        '@num' => $results['count'],
        '@entity' => $results['entity'],
      ]);
    }
    else {
      $message = t('Successfully deleted @num @entity(s) with @bundle.', [
        '@num' => $results['count'],
        '@entity' => $results['entity'],
        '@bundle' => $results['bundle'],
      ]);
    }
  }
  else {
    $message = t('Finished with an error.');
  }
  drupal_set_message($message);
}