public function DeleteContent::deleteAllEntityType in Drush Delete All 3.x
Same name and namespace in other branches
- 8.2 src/DeleteContent.php \Drupal\drush_delete\DeleteContent::deleteAllEntityType()
Function that provides the deleteing content functionality.
File
- src/
DeleteContent.php, line 63
Class
- DeleteContent
- Delete content service class.
Namespace
Drupal\drush_deleteCode
public function deleteAllEntityType($type) {
$nids = $this
->getEntityIds($type);
if (!empty($nids)) {
$no_delete = 0;
foreach ($nids as $nid) {
$this->entityTypeManager
->getStorage('node')
->load($nid)
->delete();
$no_delete++;
}
return $no_delete . " no of contents are deleted";
}
else {
return "Content not found !";
}
}