You are here

public function WordPressTag::__construct in WordPress Migrate 7

Same name and namespace in other branches
  1. 7.2 wordpress_tag.inc \WordPressTag::__construct()

Set it up

Overrides WordPressMigration::__construct

File

./wordpress_tag.inc, line 58
Support for migrating tags from a WordPress blog into Drupal.

Class

WordPressTag
Implementation of WordPressMigration, for tags

Code

public function __construct(array $arguments = array()) {
  parent::__construct($arguments);

  // The slug is what we would call the machine name, the unique
  // identifier of a tag.
  $this->map = new MigrateSQLMap($this->machineName, array(
    'tag_slug' => array(
      'type' => 'varchar',
      'length' => 255,
      'not null' => TRUE,
      'description' => 'WordPress tag machine name',
    ),
  ), MigrateDestinationTerm::getKeySchema());

  // Construct the source and destination objects.
  $this->source = new WordPressTagSource($this->wxrFile);
  $this->destination = new MigrateDestinationTerm(variable_get('wordpress_migrate_tag_vocabulary', ''));

  // The basic mappings
  $this
    ->addFieldMapping('name', 'tag_name');
  $this
    ->addFieldMapping('description', 'tag_description');
  $this
    ->addFieldMapping('parent_name')
    ->issueGroup('DNM');

  // Unmapped destination fields
  $this
    ->addFieldMapping('parent');
  $this
    ->addFieldMapping('format');
  $this
    ->addFieldMapping('weight');
  $this
    ->addFieldMapping('path');
}