You are here

countries.migrate.inc in Countries 8

Same filename and directory in other branches
  1. 7.2 countries.migrate.inc

Base integration with the Migrate API class.

File

countries.migrate.inc
View source
<?php

/**
 * @file
 * Base integration with the Migrate API class.
 */

/**
 * Custom extended MigrateFieldHandler class.
 */
class MigrateCountryFieldHandler extends MigrateFieldHandler {
  public function __construct() {
    $this
      ->registerTypes(array(
      'country',
    ));
  }
  public function prepare($entity, array $field_info, array $instance, array $values) {
    $arguments = isset($values['arguments']) ? $values['arguments'] : array();
    $language = $this
      ->getFieldLanguage($entity, $field_info, $arguments);
    $delta = 0;
    foreach ($values as $value) {
      $return[$language][$delta]['iso2'] = $value;
      $delta++;
    }
    return isset($return) ? $return : NULL;
  }

}

Classes

Namesort descending Description
MigrateCountryFieldHandler Custom extended MigrateFieldHandler class.