function ContentDevelGenerate::contentKill
Same name in other branches
- 8.x-1.x devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::contentKill()
- 5.x devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::contentKill()
Deletes all nodes of given node types.
Parameters
array $values: The input values from the settings form.
2 calls to ContentDevelGenerate::contentKill()
- ContentDevelGenerate::batchContentKill in devel_generate/
src/ Plugin/ DevelGenerate/ ContentDevelGenerate.php - Batch wrapper for calling ContentKill.
- ContentDevelGenerate::generateContent in devel_generate/
src/ Plugin/ DevelGenerate/ ContentDevelGenerate.php - Generate content when not in batch mode.
File
-
devel_generate/
src/ Plugin/ DevelGenerate/ ContentDevelGenerate.php, line 580
Class
- ContentDevelGenerate
- Provides a ContentDevelGenerate plugin.
Namespace
Drupal\devel_generate\Plugin\DevelGenerateCode
protected function contentKill(array $values) {
$nids = $this->nodeStorage
->getQuery()
->condition('type', $values['node_types'], 'IN')
->execute();
if (!empty($nids)) {
$nodes = $this->nodeStorage
->loadMultiple($nids);
$this->nodeStorage
->delete($nodes);
$this->setMessage($this->t('Deleted %count nodes.', [
'%count' => count($nids),
]));
}
}