protected function TermDevelGenerate::deleteVocabularyTerms in Devel 4.x
Same name and namespace in other branches
- 8.3 devel_generate/src/Plugin/DevelGenerate/TermDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\TermDevelGenerate::deleteVocabularyTerms()
- 8 devel_generate/src/Plugin/DevelGenerate/TermDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\TermDevelGenerate::deleteVocabularyTerms()
- 8.2 devel_generate/src/Plugin/DevelGenerate/TermDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\TermDevelGenerate::deleteVocabularyTerms()
Deletes all terms of given vocabularies.
Parameters
array $vids: Array of vocabulary ids.
Return value
int The number of terms deleted.
1 call to TermDevelGenerate::deleteVocabularyTerms()
- TermDevelGenerate::generateTerms in devel_generate/
src/ Plugin/ DevelGenerate/ TermDevelGenerate.php - Generates taxonomy terms for a list of given vocabularies.
File
- devel_generate/
src/ Plugin/ DevelGenerate/ TermDevelGenerate.php, line 238
Class
- TermDevelGenerate
- Provides a TermDevelGenerate plugin.
Namespace
Drupal\devel_generate\Plugin\DevelGenerateCode
protected function deleteVocabularyTerms(array $vids) {
$tids = $this->vocabularyStorage
->getToplevelTids($vids);
$terms = $this->termStorage
->loadMultiple($tids);
$total_deleted = 0;
foreach ($vids as $vid) {
$total_deleted += count($this->termStorage
->loadTree($vid));
}
$this->termStorage
->delete($terms);
return $total_deleted;
}