public function VocabularyStorage::getToplevelTids in Drupal 10
Same name and namespace in other branches
- 8 core/modules/taxonomy/src/VocabularyStorage.php \Drupal\taxonomy\VocabularyStorage::getToplevelTids()
 - 9 core/modules/taxonomy/src/VocabularyStorage.php \Drupal\taxonomy\VocabularyStorage::getToplevelTids()
 
Gets top-level term IDs of vocabularies.
Parameters
array $vids: Array of vocabulary IDs.
Return value
array Array of top-level term IDs.
Overrides VocabularyStorageInterface::getToplevelTids
File
- core/
modules/ taxonomy/ src/ VocabularyStorage.php, line 15  
Class
- VocabularyStorage
 - Defines a storage handler class for taxonomy vocabularies.
 
Namespace
Drupal\taxonomyCode
public function getToplevelTids($vids) {
  $tids = \Drupal::entityQuery('taxonomy_term')
    ->accessCheck(TRUE)
    ->condition('vid', $vids, 'IN')
    ->condition('parent.target_id', 0)
    ->execute();
  return array_values($tids);
}