You are here

protected function EntityShareTaxonomyExport::loadParentTree in Entity Share 7

Load the parent tree.

Parameters

object $term: Term to extract parent.

Return value

object Term to with parents.

1 call to EntityShareTaxonomyExport::loadParentTree()
EntityShareTaxonomyExport::exportTerm in modules/entity_share_taxonomy/includes/entity_share_taxonomy.export.inc
Export the term.

File

modules/entity_share_taxonomy/includes/entity_share_taxonomy.export.inc, line 100
Class for handling taxonomy Export.

Class

EntityShareTaxonomyExport
A class to export the taxonomy term.

Code

protected function loadParentTree($term) {
  if ($parents = $this
    ->getParentsTerm($term)) {
    foreach ($parents as $tid) {
      if ($tid != 0) {
        $parent = $this
          ->getFullyLoadedTerm($tid);
      }
      else {
        $parent = 0;
      }

      // For the entity save.
      $term->parent[] = $parent;
      unset($term->parents);
      if (!empty($parent->parents)) {
        $this
          ->loadParentTree($parent);
      }
    }
  }
  return $term;
}