You are here

public function TermStorage::loadChildren in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/taxonomy/src/TermStorage.php \Drupal\taxonomy\TermStorage::loadChildren()
  2. 10 core/modules/taxonomy/src/TermStorage.php \Drupal\taxonomy\TermStorage::loadChildren()

Finds all children of a term ID.

Parameters

int $tid: Term ID to retrieve children for.

string $vid: An optional vocabulary ID to restrict the child search.

Return value

\Drupal\taxonomy\TermInterface[] An array of term objects that are the children of the term $tid.

Overrides TermStorageInterface::loadChildren

File

core/modules/taxonomy/src/TermStorage.php, line 197

Class

TermStorage
Defines a Controller class for taxonomy terms.

Namespace

Drupal\taxonomy

Code

public function loadChildren($tid, $vid = NULL) {

  /** @var \Drupal\taxonomy\TermInterface $term */
  return !empty($tid) && ($term = $this
    ->load($tid)) ? $this
    ->getChildren($term) : [];
}