TaxonomyDeleteBatch.php in Taxonomy Delete 8
File
src/TaxonomyDeleteBatch.php
View source
<?php
namespace Drupal\taxonomy_delete;
class TaxonomyDeleteBatch {
public static function processVocabulary($vid, array $context) {
$service = \Drupal::service('taxonomy_delete.term_delete');
$term_count = $service
->deleteTermByVid($vid);
$context['results']['terms'] = $term_count;
$context['results']['vid'] = $vid;
}
public static function finishProcess($success, array $results, array $operations) {
if ($success) {
$message = \Drupal::translation()
->formatPlural($results['terms'], 'One term deleted in ', '@count terms deleted in @vid', [
'@vid' => $results['vid'],
]);
}
else {
$message = t("Processed with errors");
}
\Drupal::messenger()
->addMessage($message);
}
}