You are here

public function Iterator::transform in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/migrate/src/Plugin/migrate/process/Iterator.php \Drupal\migrate\Plugin\migrate\process\Iterator::transform()

Runs a process pipeline on each destination property per list item.

Overrides ProcessPluginBase::transform

File

core/modules/migrate/src/Plugin/migrate/process/Iterator.php, line 29
Contains \Drupal\migrate\Plugin\migrate\process\Iterator.

Class

Iterator
This plugin iterates and processes an array.

Namespace

Drupal\migrate\Plugin\migrate\process

Code

public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
  $return = array();
  foreach ($value as $key => $new_value) {
    $new_row = new Row($new_value, array());
    $migrate_executable
      ->processRow($new_row, $this->configuration['process']);
    $destination = $new_row
      ->getDestination();
    if (array_key_exists('key', $this->configuration)) {
      $key = $this
        ->transformKey($key, $migrate_executable, $new_row);
    }
    $return[$key] = $destination;
  }
  return $return;
}