You are here

public function TermStorageInterface::loadTree in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/taxonomy/src/TermStorageInterface.php \Drupal\taxonomy\TermStorageInterface::loadTree()
  2. 10 core/modules/taxonomy/src/TermStorageInterface.php \Drupal\taxonomy\TermStorageInterface::loadTree()

Finds all terms in a given vocabulary ID.

Parameters

string $vid: Vocabulary ID to retrieve terms for.

int $parent: The term ID under which to generate the tree. If 0, generate the tree for the entire vocabulary.

int $max_depth: The number of levels of the tree to return. Leave NULL to return all levels.

bool $load_entities: If TRUE, a full entity load will occur on the term objects. Otherwise they are partial objects queried directly from the {taxonomy_term_data} table to save execution time and memory consumption when listing large numbers of terms. Defaults to FALSE.

Return value

object[]|\Drupal\taxonomy\TermInterface[] An array of term objects that are the children of the vocabulary $vid.

1 method overrides TermStorageInterface::loadTree()
TermStorage::loadTree in core/modules/taxonomy/src/TermStorage.php
Finds all terms in a given vocabulary ID.

File

core/modules/taxonomy/src/TermStorageInterface.php, line 92

Class

TermStorageInterface
Defines an interface for taxonomy_term entity storage classes.

Namespace

Drupal\taxonomy

Code

public function loadTree($vid, $parent = 0, $max_depth = NULL, $load_entities = FALSE);