You are here

private function MergeTerms::getTermOptions in Term Merge 8

Builds a list of all terms in this vocabulary.

Parameters

\Drupal\taxonomy\VocabularyInterface $vocabulary: The vocabulary.

Return value

string[] An array of taxonomy term labels keyed by their id.

1 call to MergeTerms::getTermOptions()
MergeTerms::buildForm in src/Form/MergeTerms.php
Plugin annotation @SuppressWarnings(camelCase);

File

src/Form/MergeTerms.php, line 161

Class

MergeTerms
Term merge form.

Namespace

Drupal\term_merge\Form

Code

private function getTermOptions(VocabularyInterface $vocabulary) {
  $options = [];
  $terms = $this->termStorage
    ->loadByProperties([
    'vid' => $vocabulary
      ->id(),
  ]);
  foreach ($terms as $term) {
    $options[$term
      ->id()] = $term
      ->label();
  }
  return $options;
}