public static function TaxonomyManagerHelper::vocabularyIsEmpty in Taxonomy Manager 8
Same name and namespace in other branches
- 2.0.x src/TaxonomyManagerHelper.php \Drupal\taxonomy_manager\TaxonomyManagerHelper::vocabularyIsEmpty()
Checks if voc has terms.
Parameters
int $vid: The term ID.
Return value
bool True, if terms already exists, else false
1 call to TaxonomyManagerHelper::vocabularyIsEmpty()
- TaxonomyManagerForm::buildForm in src/
Form/ TaxonomyManagerForm.php - Form constructor.
File
- src/
TaxonomyManagerHelper.php, line 21
Class
- TaxonomyManagerHelper
- Class for taxonomy manager helper.
Namespace
Drupal\taxonomy_managerCode
public static function vocabularyIsEmpty($vid) {
/** @var \Drupal\taxonomy\TermStorageInterface $term_storage */
$term_storage = \Drupal::entityTypeManager()
->getStorage('taxonomy_term');
return empty($term_storage
->loadTree($vid));
}