public static function TaxonomyManagerTree::getChildCount in Taxonomy Manager 8
Same name and namespace in other branches
- 2.0.x src/Element/TaxonomyManagerTree.php \Drupal\taxonomy_manager\Element\TaxonomyManagerTree::getChildCount()
Helper function that returns the number of child terms.
1 call to TaxonomyManagerTree::getChildCount()
- TaxonomyManagerTree::getNestedListJsonArray in src/
Element/ TaxonomyManagerTree.php - Function that generates the nested list for the JSON array structure.
File
- src/
Element/ TaxonomyManagerTree.php, line 276
Class
- TaxonomyManagerTree
- Taxonomy Manager Tree Form Element.
Namespace
Drupal\taxonomy_manager\ElementCode
public static function getChildCount($tid) {
static $tids = [];
if (!isset($tids[$tid])) {
/** @var \Drupal\taxonomy\TermInterface $term */
$term = Term::load($tid);
$tids[$tid] = count(static::getTermStorage()
->loadTree($term
->bundle(), $tid, 1));
}
return $tids[$tid];
}