public function EntityShareTaxonomyImport::importDatas in Entity Share 7
Manage taxonomy for the import.
File
- modules/
entity_share_taxonomy/ includes/ entity_share_taxonomy.import.inc, line 19 - Class for handling Taxonomy Import.
Class
- EntityShareTaxonomyImport
- A class to import the Taxonomy.
Code
public function importDatas() {
// Check if the field type is managed by the module.
if (!$this
->isManagedFieldType()) {
return;
}
$entity_info = entity_get_info($this->fieldEntityType);
$term = (object) $this->fieldData;
// If there is parents, treat parent first, then continue.
$this
->manageParents($term);
// It's very important to keep the recursion there cos we have to walk
// over the tree in reverse order in order to create the term in
// sub field before the parents terms.
$this->entityShareEntity
->contentFieldWalk($term);
$this
->setLocalIds($term);
// Create or update the taxonomy term.
taxonomy_term_save($term);
// Set the tid (just created if it was not existing or
// updated if already existing).
$this->fieldData = NULL;
$this->fieldData[$entity_info['entity keys']['id']] = $term->{$entity_info['entity keys']['id']};
}