summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/taxonomy/src/VocabularyStorage.php
blob: 03f51866b4bd240db59bdff0bf88b154fdf97dbb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

namespace Drupal\taxonomy;

use Drupal\Core\Config\Entity\ConfigEntityStorage;

/**
 * Defines a storage handler class for taxonomy vocabularies.
 */
class VocabularyStorage extends ConfigEntityStorage implements VocabularyStorageInterface {

  /**
   * {@inheritdoc}
   */
  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);
  }

}