public function DrupalTermMigration::__construct in Drupal-to-Drupal data migration 7.2
In addition to the arguments supported by DrupalMigration, we add the following required arguments:
source_vocabulary - Unique identifier for the source vocabulary (a vid through Drupal 6, machine name for Drupal 7 and later). This may be a comma-separated list, to support merging multiple vocabularies into one. destination_vocabulary - Machine name of the destination vocabulary.
Parameters
array $arguments:
Overrides DrupalMigration::__construct
3 calls to DrupalTermMigration::__construct()
- DrupalTerm5Migration::__construct in d5/
taxonomy.inc - In addition to the arguments supported by DrupalMigration, we add the following required arguments:
- DrupalTerm6Migration::__construct in d6/
taxonomy.inc - In addition to the arguments supported by DrupalMigration, we add the following required arguments:
- DrupalTerm7Migration::__construct in d7/
taxonomy.inc - In addition to the arguments supported by DrupalMigration, we add the following required arguments:
3 methods override DrupalTermMigration::__construct()
- DrupalTerm5Migration::__construct in d5/
taxonomy.inc - In addition to the arguments supported by DrupalMigration, we add the following required arguments:
- DrupalTerm6Migration::__construct in d6/
taxonomy.inc - In addition to the arguments supported by DrupalMigration, we add the following required arguments:
- DrupalTerm7Migration::__construct in d7/
taxonomy.inc - In addition to the arguments supported by DrupalMigration, we add the following required arguments:
File
- ./
taxonomy.inc, line 39 - Base class for migrating taxonomy terms into Drupal.
Class
- DrupalTermMigration
- Base class for migrations of Drupal taxonomy terms from another Drupal installation.
Code
public function __construct(array $arguments) {
parent::__construct($arguments);
$this->sourceVocabulary = $arguments['source_vocabulary'];
$this->destinationVocabulary = $arguments['destination_vocabulary'];
$this->sourceFields += $this->version
->getSourceFields('taxonomy_term', $this->sourceVocabulary);
if ($this
->moduleExists('path')) {
$this->sourceFields['path'] = t('Path alias');
}
// Create our three main objects - source, destination, and map
$this->source = new MigrateSourceSQL($this
->query(), $this->sourceFields, NULL, $this->sourceOptions);
$this->destination = new MigrateDestinationTerm($this->destinationVocabulary);
$this->map = new MigrateSQLMap($this->machineName, array(
'tid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'Source term ID',
'alias' => 'td',
),
), MigrateDestinationTerm::getKeySchema(), $this->mapConnection);
// Mappings are straight-forward
$this
->addSimpleMappings(array(
'name',
'description',
'weight',
));
$this
->addFieldMapping('parent', 'parent')
->sourceMigration($this->machineName);
$this
->addUnmigratedDestinations(array(
'parent_name',
));
if ($this
->moduleExists('path')) {
$this
->addFieldMapping('path', 'path')
->description('Handled in prepareRow');
}
if (module_exists('pathauto')) {
$this
->addFieldMapping('pathauto')
->description('By default, disable in favor of migrated paths')
->defaultValue(0);
}
}