You are here

public function TermStorage::getChildren in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/taxonomy/src/TermStorage.php \Drupal\taxonomy\TermStorage::getChildren()

Returns all children terms of this term.

@internal @todo Refactor away when TreeInterface is introduced.

Return value

\Drupal\taxonomy\TermInterface[] A list of children taxonomy term entities keyed by term ID.

1 call to TermStorage::getChildren()
TermStorage::loadChildren in core/modules/taxonomy/src/TermStorage.php
Finds all children of a term ID.

File

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

Class

TermStorage
Defines a Controller class for taxonomy terms.

Namespace

Drupal\taxonomy

Code

public function getChildren(TermInterface $term) {
  $query = \Drupal::entityQuery('taxonomy_term')
    ->accessCheck(TRUE)
    ->condition('parent', $term
    ->id());
  return static::loadMultiple($query
    ->execute());
}