You are here

private function MergeTermsTarget::buildExistingTermsOptions in Term Merge 8

Builds an array of existing terms.

Return value

string[] Existing term labels keyed by id.

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

File

src/Form/MergeTermsTarget.php, line 167

Class

MergeTermsTarget
Term merge target terms form.

Namespace

Drupal\term_merge\Form

Code

private function buildExistingTermsOptions() {
  $query = $this->termStorage
    ->getQuery();
  $query
    ->condition('vid', $this->vocabulary
    ->id())
    ->condition('tid', $this
    ->getSelectedTermIds(), 'NOT IN');
  $terms = $this->termStorage
    ->loadMultiple($query
    ->execute());
  $options = [];
  foreach ($terms as $term) {
    $options[$term
      ->id()] = $term
      ->label();
  }
  return $options;
}