You are here

public static function VocabularyScheme::getTerms in Colors 8

Get terms.

Parameters

string $vid: The vocabulary machine-name

Return value

array Array of terms keyed by the term id.

File

src/Plugin/colors/type/VocabularyScheme.php, line 58

Class

VocabularyScheme
Provides colors for taxonomy terms.

Namespace

Drupal\colors\Plugin\colors\type

Code

public static function getTerms($vid) {
  $tree = \Drupal::entityTypeManager()
    ->getStorage('taxonomy_term')
    ->loadTree($vid);
  $terms = array();
  foreach ($tree as $term) {
    $terms[$term->tid] = $term->name;
  }
  return $terms;
}