You are here

protected function DrupalMigration::mapFormat in Drupal-to-Drupal data migration 7.2

Field mapping callback: translate an incoming format ID (through D6) or machine name (D7+) to a D7 format machine name.

Parameters

$format:

Return value

string|array

File

./migrate_d2d.migrate.inc, line 190
Base classes for all Drupal-to-Drupal migration classes.

Class

DrupalMigration
@file Base classes for all Drupal-to-Drupal migration classes.

Code

protected function mapFormat($format) {
  if (!is_array($format)) {
    $format = array(
      $format,
    );
  }
  $result = array();
  foreach ($format as $format_value) {
    if (isset($format_value) && isset($this->formatMappings[$format_value])) {
      $result[] = $this->formatMappings[$format_value];
    }
    else {
      $result[] = NULL;
    }
  }

  // Only return an array if we have to
  if (count($result) > 1) {
    return $result;
  }
  else {
    return reset($result);
  }
}