You are here

public function Taxonomy::getParentIds in Facets 8

Retrieve all parent ids for one specific id.

Parameters

string $id: An entity id.

Return value

array An array of all parent ids.

Overrides HierarchyInterface::getParentIds

1 call to Taxonomy::getParentIds()
Taxonomy::getSiblingIds in src/Plugin/facets/hierarchy/Taxonomy.php
Provide a default implementation for backward compatibility.

File

src/Plugin/facets/hierarchy/Taxonomy.php, line 73

Class

Taxonomy
Taxonomy hierarchy.

Namespace

Drupal\facets\Plugin\facets\hierarchy

Code

public function getParentIds($id) {
  $current_tid = $id;
  while ($parent = $this
    ->taxonomyGetParent($current_tid)) {
    $current_tid = $parent;
    $parents[$id][] = $parent;
  }
  return isset($parents[$id]) ? $parents[$id] : [];
}