You are here

private function HierarchicalTaxonomyMenuBlock::getEntityIds in Hierarchical Taxonomy Menu 8

Gets all entities referencing the given term.

1 call to HierarchicalTaxonomyMenuBlock::getEntityIds()
HierarchicalTaxonomyMenuBlock::build in src/Plugin/Block/HierarchicalTaxonomyMenuBlock.php
Builds and returns the renderable array for this block plugin.

File

src/Plugin/Block/HierarchicalTaxonomyMenuBlock.php, line 870

Class

HierarchicalTaxonomyMenuBlock
Provides a 'HierarchicalTaxonomyMenuBlock' block.

Namespace

Drupal\hierarchical_taxonomy_menu\Plugin\Block

Code

private function getEntityIds($entity_type_id, $field_name, $tid, $vocabulary, $calculate_count_recursively) {
  if (!$calculate_count_recursively) {
    return $this
      ->getEntityIdsForTerm($entity_type_id, $field_name, $tid);
  }
  else {
    $entity_ids = $this
      ->getEntityIdsForTerm($entity_type_id, $field_name, $tid);
    $child_tids = $this->entityTypeManager
      ->getStorage('taxonomy_term')
      ->loadTree($vocabulary, $tid);
    foreach ($child_tids as $child_tid) {
      $entity_ids = array_merge($entity_ids, $this
        ->getEntityIdsForTerm($entity_type_id, $field_name, $child_tid->tid));
    }
    return $entity_ids;
  }
}