You are here

private function SocialTaggingService::prepareTermOptions in Open Social 8.9

Same name and namespace in other branches
  1. 8.8 modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::prepareTermOptions()
  2. 10.3.x modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::prepareTermOptions()
  3. 10.0.x modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::prepareTermOptions()
  4. 10.1.x modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::prepareTermOptions()
  5. 10.2.x modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::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 SocialTaggingService::prepareTermOptions()
SocialTaggingService::getCategories in modules/social_features/social_tagging/src/SocialTaggingService.php
Returns all the top level term items, that are considered categories.
SocialTaggingService::getChildren in modules/social_features/social_tagging/src/SocialTaggingService.php
Returns the children of top level term items.

File

modules/social_features/social_tagging/src/SocialTaggingService.php, line 250

Class

SocialTaggingService
Provides a custom tagging service.

Namespace

Drupal\social_tagging

Code

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