class MigrateIntervalFieldHandler in Migrate Extras 7.2
Primary value passed to this field must be interval value itself (number of periods).
Pass the period as an argument, e.g.:
$arguments = array(
'period' => 'month',
);
$this
->addFieldMapping('field_subscription_duration', 'num_months')
->arguments($arguments);
Hierarchy
- class \MigrateHandler
- class \MigrateFieldHandler
- class \MigrateIntervalFieldHandler
- class \MigrateFieldHandler
Expanded class hierarchy of MigrateIntervalFieldHandler
1 string reference to 'MigrateIntervalFieldHandler'
File
- ./
interval.inc, line 15
View source
class MigrateIntervalFieldHandler extends MigrateFieldHandler {
public function __construct() {
$this
->registerTypes(array(
'interval',
));
}
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) {
$return[$language][$delta] = array(
'interval' => $value,
'period' => $arguments['period'],
);
$delta++;
}
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 | |
MigrateIntervalFieldHandler:: |
public | function | ||
MigrateIntervalFieldHandler:: |
public | function |
Overrides MigrateHandler:: |