1
|
<?php
|
2
|
/**
|
3
|
* @file
|
4
|
* Support for processing entity reference fields in Migrate.
|
5
|
*/
|
6
|
|
7
|
/**
|
8
|
* Implements hook_migrate_api().
|
9
|
*/
|
10
|
function entityreference_migrate_api() {
|
11
|
return array(
|
12
|
'api' => 2,
|
13
|
'field handlers' => array('MigrateEntityReferenceFieldHandler'),
|
14
|
);
|
15
|
}
|
16
|
|
17
|
/**
|
18
|
* Extended class for handling entityreference fields.
|
19
|
*/
|
20
|
class MigrateEntityReferenceFieldHandler extends MigrateSimpleFieldHandler {
|
21
|
|
22
|
/**
|
23
|
* Constructor.
|
24
|
*/
|
25
|
public function __construct() {
|
26
|
parent::__construct(array(
|
27
|
'value_key' => 'target_id',
|
28
|
'skip_empty' => TRUE,
|
29
|
));
|
30
|
|
31
|
$this->registerTypes(array('entityreference'));
|
32
|
}
|
33
|
}
|