You are here

public function Flatten::transform in Zircon Profile 8

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

Flatten nested array values to single array values.

For example, array(array(1, 2, array(3, 4))) becomes array(1, 2, 3, 4).

Overrides ProcessPluginBase::transform

File

core/modules/migrate/src/Plugin/migrate/process/Flatten.php, line 34
Contains \Drupal\migrate\Plugin\migrate\process\Flatten.

Class

Flatten
This plugin flattens the current value.

Namespace

Drupal\migrate\Plugin\migrate\process

Code

public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
  return iterator_to_array(new \RecursiveIteratorIterator(new \RecursiveArrayIterator($value)), FALSE);
}