protected function DrupalTermMigration::createStub in Drupal-to-Drupal data migration 7.2
Implementation of Migration::createStub().
Parameters
$migration:
Return value
array|bool
File
- ./
taxonomy.inc, line 115 - Base class for migrating taxonomy terms into Drupal.
Class
- DrupalTermMigration
- Base class for migrations of Drupal taxonomy terms from another Drupal installation.
Code
protected function createStub($migration, $source_key) {
// Ignore an attempt to create a stub corresponding to "tid" 0.
if ($source_key[0] == 0) {
return FALSE;
}
migrate_instrument_start('DrupalTermMigration::createStub');
$vocab = taxonomy_vocabulary_machine_name_load($this->destinationVocabulary);
$term = new stdClass();
$term->vid = $vocab->vid;
$term->name = t('Stub');
taxonomy_term_save($term);
migrate_instrument_stop('DrupalTermMigration::createStub');
if (isset($term->tid)) {
return array(
$term->tid,
);
}
else {
return FALSE;
}
}