private function SocialTaggingService::prepareTermOptions in Open Social 8.8
Same name and namespace in other branches
- 8.9 modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::prepareTermOptions()
- 10.3.x modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::prepareTermOptions()
- 10.0.x modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::prepareTermOptions()
- 10.1.x modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::prepareTermOptions()
- 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_taggingCode
private function prepareTermOptions(array $terms) {
$options = [];
foreach ($terms as $category) {
$options[$category->tid] = $category->name;
}
return $options;
}