You are here

public function SocialTaggingService::getChildren in Open Social 8.3

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::getChildren()
  2. 8 modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::getChildren()
  3. 8.2 modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::getChildren()
  4. 8.4 modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::getChildren()
  5. 8.5 modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::getChildren()
  6. 8.6 modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::getChildren()
  7. 8.7 modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::getChildren()
  8. 8.8 modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::getChildren()
  9. 10.3.x modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::getChildren()
  10. 10.0.x modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::getChildren()
  11. 10.1.x modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::getChildren()
  12. 10.2.x modules/social_features/social_tagging/src/SocialTaggingService.php \Drupal\social_tagging\SocialTaggingService::getChildren()

Returns the children of top level term items.

Parameters

int $category: The category you want to fetch the child items from.

Return value

array An array of child items.

1 call to SocialTaggingService::getChildren()
SocialTaggingService::getAllChildren in modules/social_features/social_tagging/src/SocialTaggingService.php
Returns all the children of top level term items.

File

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

Class

SocialTaggingService
Provides a custom tagging service.

Namespace

Drupal\social_tagging

Code

public function getChildren($category) {

  // Define as array.
  $options = [];

  // Fetch main categories.
  foreach ($this->termStorage
    ->loadTree('social_tagging', $category, 1) as $category) {
    $options[$category->tid] = $category->name;
  }

  // Return array.
  return $options;
}