public function DeleteContent::deleteAllTerms in Drush Delete All 8.2
Same name and namespace in other branches
- 3.x src/DeleteContent.php \Drupal\drush_delete\DeleteContent::deleteAllTerms()
To delete the taxonomy vocabulary terms.
Parameters
string $type: Entity type.
Return value
string return.
File
- src/
DeleteContent.php, line 95
Class
Namespace
Drupal\drush_deleteCode
public function deleteAllTerms($type) {
$tids = \Drupal::entityQuery('taxonomy_term')
->condition('vid', $type)
->execute();
if (!empty($tids)) {
$count = count($tids);
$controller = \Drupal::entityTypeManager()
->getStorage('taxonomy_term');
$entities = $controller
->loadMultiple($tids);
$controller
->delete($entities);
return $count . " no of contents are deleted";
}
else {
return "Content not found !";
}
}