You are here

protected function EntityShareTaxonomyImport::manageParents in Entity Share 7

Manage the parents of a term to import.

Parameters

object $term: Term to import.

1 call to EntityShareTaxonomyImport::manageParents()
EntityShareTaxonomyImport::importDatas in modules/entity_share_taxonomy/includes/entity_share_taxonomy.import.inc
Manage taxonomy for the import.

File

modules/entity_share_taxonomy/includes/entity_share_taxonomy.import.inc, line 102
Class for handling Taxonomy Import.

Class

EntityShareTaxonomyImport
A class to import the Taxonomy.

Code

protected function manageParents($term) {
  if (!empty($term->parent)) {
    foreach ($term->parent as &$parent) {
      if ($parent != 0) {
        $parent = (object) $parent;

        // The parent has parent.
        if (!empty($parent->parent)) {
          $this
            ->manageParents($parent);
        }

        // Import parent term.
        $import = new EntityShareEntityImport($parent);
        $tid = $import
          ->execute();

        // Set the parent tid.
        $parent = $tid;
      }
    }
  }
}