video_embed_field.migrate.inc in Video Embed Field 7.2
Migrate support for Video Embed Field module.
File
video_embed_field.migrate.inc
View source
<?php
function video_embed_field_migrate_api() {
$api = array(
'api' => 2,
'field handlers' => array(
'MigrateVideoEmbedFieldFieldHandler',
),
);
return $api;
}
class MigrateVideoEmbedFieldFieldHandler extends MigrateFieldHandler {
public function __construct() {
$this
->registerTypes(array(
'video_embed_field',
));
}
public function fields($type, $parent_field, $migration = NULL) {
$fields = array(
'video_url' => t('Video: The video URL.'),
);
return $fields;
}
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);
$delta = 0;
foreach ($values as $value) {
$return[$language][$delta] = array(
'video_url' => $value,
);
$delta++;
}
return isset($return) ? $return : NULL;
}
}