You are here

public function ImporterService::getParentTree in Hierarchical Taxonomy Import 8

Returns all parents of current term.

Parameters

$data:

$row:

$pointer:

Return value

array

1 call to ImporterService::getParentTree()
ImporterService::import in src/services/ImporterService.php

File

src/services/ImporterService.php, line 154

Class

ImporterService
Class ImporterService.

Namespace

Drupal\hierarchical_taxonomy_importer\services

Code

public function getParentTree($data, $row, $pointer) {
  $tree = [];
  $iterator = $row;
  $level = $pointer - 1;
  while ($level >= 0 && $iterator >= 0) {
    if (!empty($data[$iterator][$level])) {
      $tree[] = $data[$iterator][$level];
      $level -= 1;
    }
    $iterator -= 1;
  }
  return $tree;
}