You are here

class MigrateVideoEmbedFieldFieldHandler in Video Embed Field 7.2

Custom extended MigrateFieldHandler class for Video Embed Field module.

Hierarchy

Expanded class hierarchy of MigrateVideoEmbedFieldFieldHandler

1 string reference to 'MigrateVideoEmbedFieldFieldHandler'
video_embed_field_migrate_api in ./video_embed_field.migrate.inc
Implements hook_migrate_api().

File

./video_embed_field.migrate.inc, line 21
Migrate support for Video Embed Field module.

View source
class MigrateVideoEmbedFieldFieldHandler extends MigrateFieldHandler {
  public function __construct() {
    $this
      ->registerTypes(array(
      'video_embed_field',
    ));
  }

  /**
   * {@inheritdoc}
   */
  public function fields($type, $parent_field, $migration = NULL) {
    $fields = array(
      'video_url' => t('Video: The video URL.'),
    );
    return $fields;
  }

  /**
   * {@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) {
      $return[$language][$delta] = array(
        'video_url' => $value,
      );
      $delta++;
    }
    return isset($return) ? $return : NULL;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MigrateFieldHandler::getFieldLanguage function Determine the language of the field.
MigrateHandler::$dependencies protected property List of other handler classes which should be invoked before the current one.
MigrateHandler::$typesHandled protected property List of "types" handled by this handler. Depending on the kind of handler, these may be destination types, field types, etc.
MigrateHandler::getDependencies public function
MigrateHandler::getTypesHandled public function
MigrateHandler::handlesType public function Does this handler handle the given type? 1
MigrateHandler::registerTypes protected function Register a list of types handled by this class
MigrateVideoEmbedFieldFieldHandler::fields public function
MigrateVideoEmbedFieldFieldHandler::prepare public function
MigrateVideoEmbedFieldFieldHandler::__construct public function Overrides MigrateHandler::__construct