class MigrateMobileNumberFieldHandler in Mobile Number 7
Migration class for migrating field content to mobile_number fields.
Hierarchy
- class \MigrateHandler
- class \MigrateFieldHandler
Expanded class hierarchy of MigrateMobileNumberFieldHandler
1 string reference to 'MigrateMobileNumberFieldHandler'
- mobile_number_migrate_api in ./
mobile_number.migrate.inc - Implements hook_migrate_api().
File
- ./
mobile_number.migrate.inc, line 22 - Integration with Migrate.
View source
class MigrateMobileNumberFieldHandler extends MigrateFieldHandler {
/**
* {@inheritdoc}
*/
public function __construct() {
$this
->registerTypes(array(
'mobile_number',
));
}
/**
* {@inheritdoc}
*/
public function prepare($entity, array $field_info, array $instance, array $values) {
$arguments = array();
if (isset($values['arguments'])) {
$arguments = array_filter($values['arguments']);
unset($values['arguments']);
}
$language = $this
->getFieldLanguage($entity, $field_info, $arguments);
// Setup the standard Field API array for saving.
$delta = 0;
foreach ($values as $value) {
try {
$mobile_number = new MobileNumber($value);
$return[$language][$delta]['value'] = $mobile_number->callableNumber;
$return[$language][$delta]['country'] = $mobile_number->country;
$return[$language][$delta]['local_number'] = $mobile_number->localNumber;
$return[$language][$delta]['verified'] = 0;
$delta++;
} catch (Exception $e) {
}
}
return isset($return) ? $return : NULL;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MigrateFieldHandler:: |
function | Determine the language of the field. | ||
MigrateHandler:: |
protected | property | List of other handler classes which should be invoked before the current one. | |
MigrateHandler:: |
protected | property | List of "types" handled by this handler. Depending on the kind of handler, these may be destination types, field types, etc. | |
MigrateHandler:: |
public | function | ||
MigrateHandler:: |
public | function | ||
MigrateHandler:: |
public | function | Does this handler handle the given type? | 1 |
MigrateHandler:: |
protected | function | Register a list of types handled by this class | |
MigrateMobileNumberFieldHandler:: |
public | function | ||
MigrateMobileNumberFieldHandler:: |
public | function |
Overrides MigrateHandler:: |