You are here

public function SocialProfileTagService::getTermOptionNames in Open Social 10.3.x

Same name and namespace in other branches
  1. 10.2.x modules/social_features/social_profile/src/SocialProfileTagService.php \Drupal\social_profile\SocialProfileTagService::getTermOptionNames()

Returns list of term names as option list.

Parameters

array $term_ids: List of taxonomy term IDs.

Return value

array Options.

Overrides SocialProfileTagServiceInterface::getTermOptionNames

File

modules/social_features/social_profile/src/SocialProfileTagService.php, line 198

Class

SocialProfileTagService
Provide a service for profile tagging.

Namespace

Drupal\social_profile

Code

public function getTermOptionNames(array $term_ids) {
  $options = [];
  if (empty($term_ids)) {
    return $options;
  }

  /** @var \Drupal\taxonomy\TermInterface[] $terms */
  $terms = $this->taxonomyStorage
    ->loadMultiple($term_ids);
  foreach ($terms as $term) {
    $options[$term
      ->id()] = $term
      ->label();
  }
  return $options;
}