You are here

public function VocabularyStorage::getToplevelTids in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 28
Contains \Drupal\taxonomy\VocabularyStorage.

Class

VocabularyStorage
Defines a controller class for taxonomy vocabularies.

Namespace

Drupal\taxonomy

Code

public function getToplevelTids($vids) {
  return db_query('SELECT t.tid FROM {taxonomy_term_data} t INNER JOIN {taxonomy_term_hierarchy} th ON th.tid = t.tid WHERE t.vid IN ( :vids[] ) AND th.parent = 0', array(
    ':vids[]' => $vids,
  ))
    ->fetchCol();
}