function VocabularyStorage::getToplevelTids

Same name in other branches
  1. 9 core/modules/taxonomy/src/VocabularyStorage.php \Drupal\taxonomy\VocabularyStorage::getToplevelTids()
  2. 10 core/modules/taxonomy/src/VocabularyStorage.php \Drupal\taxonomy\VocabularyStorage::getToplevelTids()
  3. 11.x core/modules/taxonomy/src/VocabularyStorage.php \Drupal\taxonomy\VocabularyStorage::getToplevelTids()

Overrides VocabularyStorageInterface::getToplevelTids

File

core/modules/taxonomy/src/VocabularyStorage.php, line 23

Class

VocabularyStorage
Defines a storage handler class for taxonomy vocabularies.

Namespace

Drupal\taxonomy

Code

public function getToplevelTids($vids) {
    $tids = \Drupal::entityQuery('taxonomy_term')->condition('vid', $vids, 'IN')
        ->condition('parent.target_id', 0)
        ->execute();
    return array_values($tids);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.