Iterator.php in Zircon Profile 8
File
core/modules/migrate/src/Plugin/migrate/process/Iterator.php
View source
<?php
namespace Drupal\migrate\Plugin\migrate\process;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Row;
class Iterator extends ProcessPluginBase {
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;
}
protected function transformKey($key, MigrateExecutableInterface $migrate_executable, Row $row) {
$process = array(
'key' => $this->configuration['key'],
);
$migrate_executable
->processRow($row, $process, $key);
return $row
->getDestinationProperty('key');
}
public function multiple() {
return TRUE;
}
}
Classes
Name |
Description |
Iterator |
This plugin iterates and processes an array. |