You are here

function regcode_get_vocab_terms in Registration codes 8

Same name and namespace in other branches
  1. 6.2 regcode.module \regcode_get_vocab_terms()
  2. 7.2 regcode.module \regcode_get_vocab_terms()
  3. 7 regcode.module \regcode_get_vocab_terms()

Gets a list of terms from the registration code vocabulary.

File

./regcode.module, line 440
Main functionality and hooks of regcode module.

Code

function regcode_get_vocab_terms() {
  $tree = \Drupal::service('entity_type.manager')
    ->getStorage("taxonomy_term")
    ->loadTree(\Drupal::config('regcode.settings')
    ->get('regcode_vocabulary'));
  $terms = [];
  foreach ($tree as $term) {
    $terms[$term->tid] = $term->name;
  }
  return $terms;
}