public function MigrateDestinationTermMachineName::import in Taxonomy Machine Name 7
Import the provided term, using information from the provided row.
Parameters
stdclass $term: Term object to build. Prefilled with any fields mapped in the Migration.
stdclass $row: Raw source data object - passed through to prepare/complete handlers.
Return value
array Array of key fields (tid only in this case) of the term that was saved if successful. FALSE on failure.
Throws
Overrides MigrateDestinationTerm::import
1 call to MigrateDestinationTermMachineName::import()
- MigrateDestinationTermMachineName::runDeferredImports in ./
taxonomy_machine_name.migrate.inc - Attempt to import any terms for which import was previously deferred.
File
- ./
taxonomy_machine_name.migrate.inc, line 156 - Taxonomy Machine Name Migrate Module File.
Class
- MigrateDestinationTermMachineName
- Class MigrateDestinationTermMachineName
Code
public function import(stdClass $term, stdClass $row) {
// Look up parent name if provided.
if (isset($term->parent_machine_name)) {
$parent_machine_name = trim($term->parent_machine_name);
if (!empty($parent_machine_name)) {
// Default to bundle if no vocabulary machine name provided.
if (!isset($term->vocabulary_machine_name)) {
$term->vocabulary_machine_name = $this->bundle;
}
$parent_tid = taxonomy_term_machine_name_load($parent_machine_name, $term->vocabulary_machine_name);
if (!empty($parent_tid)) {
$term->parent = $parent_tid->tid;
}
else {
// Store aside for post import process once parent will be created.
$deferred_import = new stdClass();
$deferred_import->term = clone $term;
$deferred_import->row = clone $row;
$this->deferred[] = $deferred_import;
}
}
}
$tid = parent::import($term, $row);
return $tid;
}