You are here

private function SocialProfileTagService::prepareTermOptions in Open Social 10.2.x

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

Helper function to prepare term options.

Parameters

array $terms: Array of terms.

Return value

array Returns a list of terms options.

2 calls to SocialProfileTagService::prepareTermOptions()
SocialProfileTagService::getCategories in modules/social_features/social_profile/src/SocialProfileTagService.php
Returns all the top level term items, that are considered categories.
SocialProfileTagService::getChildrens in modules/social_features/social_profile/src/SocialProfileTagService.php
Returns the children of top level term items.

File

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

Class

SocialProfileTagService
Provide a service for profile tagging.

Namespace

Drupal\social_profile

Code

private function prepareTermOptions(array $terms) {
  $options = [];
  foreach ($terms as $category) {
    $options[$category->tid] = $category->name;
  }
  return $options;
}