-
Notifications
You must be signed in to change notification settings - Fork 0
/
phone.migrate.inc
40 lines (35 loc) · 1.07 KB
/
phone.migrate.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* @file phone.migrate.inc
* Code to implement hook_content_migrate_field_alter, content_migrate_instance_alter() and content_migrate_data_record_alter()
* on behalf of the former phone module, moved into a separate file for efficiency.
*/
/**
* Implements hook_content_migrate_field_alter().
*
* Use this to tweak the conversion of field settings
* from the D6 style to the D7 style for specific
* situations not handled by basic conversion,
* as when field types or settings are changed.
*/
function phone_field_alter(&$field_value, $instance_value) {
if (substr($field_value['type'], 2) === '_phone') {
$code = substr($field_value['type'], 0, 2);
$field_value['type'] = 'phone';
$field_value['settings']['country'] = $code;
}
}
/**
* Implements hook_migrate_api().
*/
function phone_migrate_api() {
return array('api' => 2);
}
/**
* Wrap Migrate's simple field handler for 'phone' fields.
*/
class MigratePhoneFieldHandler extends MigrateSimpleFieldHandler {
public function __construct() {
$this->registerTypes(array('phone'));
}
}