Skip to content
This repository has been archived by the owner on May 4, 2020. It is now read-only.

Commit

Permalink
Merge pull request #9 from aguasingas/file_entity_support
Browse files Browse the repository at this point in the history
Added File entity support.
  • Loading branch information
Pedro committed Jul 16, 2014
2 parents 7e3bd09 + 612a14f commit 015fce7
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion includes/migrate_default_content.migrate.base.inc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ abstract class defaultBaseMigration extends Migration {
}
}

private function preprocessMapping($key, $value) {
protected function preprocessMapping($key, $value) {
if (!is_array($value)) {
return;
}
Expand Down
39 changes: 39 additions & 0 deletions includes/migrate_default_content.migrate.file.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
/**
* @file
* Populate content for field collections.
*/

class defaultFile extends defaultBaseMigration {

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

$this->addDefaultMappings();

$this->map = new MigrateSQLMap($this->machineName,
array(
'id' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
),
MigrateDestinationFile::getKeySchema()
);
// Create a MigrateSource object.
$this->source = $this->getMigrationSource();
$this->destination = new MigrateDestinationFile($this->migrationData['bundle']);

}

protected function preprocessMapping($key, $value) {
if ($key == 'source_dir') {
$value['default_value'] = $this->arguments['source_path'] . '/' . $value['default_value'];
}
parent::preprocessMapping($key, $value);
}


}
1 change: 1 addition & 0 deletions migrate_default_content.info
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dependencies[] = libraries

files[] = 'includes/migrate_default_content.migrate.base.inc'
files[] = 'includes/migrate_default_content.migrate.entity.inc'
files[] = 'includes/migrate_default_content.migrate.file.inc'
files[] = 'includes/migrate_default_content.migrate.field_collection.inc'
files[] = 'includes/migrate_default_content.migrate.menu.inc'
files[] = 'includes/migrate_default_content.migrate.user.inc'
Expand Down

0 comments on commit 015fce7

Please sign in to comment.