You are here

protected function ImporterService::updateActualParent in Hierarchical Taxonomy Import 8

This method calculates upon CSV data and finds out actual parent.

Parameters

string $vid: Vocabulary ID.

string $term_name: current taxonomy term name.

numeric $parent: Parent ID

numeric $tag: This tells that if next term is to import is on same parent level, new parent level or on nested levels backward.

Return value

numeric Parent Term ID.

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

File

src/services/ImporterService.php, line 234

Class

ImporterService
Class ImporterService.

Namespace

Drupal\hierarchical_taxonomy_importer\services

Code

protected function updateActualParent($vid, $term_name, $parent, $tag) {
  $new_term_id = $this
    ->createNewTerm($vid, $term_name, $parent);

  // When importing sibling terms
  if ($tag !== $this::SAME_PARENT) {
    $parent = $new_term_id;
  }
  return $parent;
}