/** * {@inheritdoc} */ public function processRow(Row $row, array $process = NULL, $value = NULL) { foreach ($this->migration->getProcessPlugins($process) as $destination => $plugins) { $multiple = FALSE; /** @var $plugin \Drupal\migrate\Plugin\MigrateProcessInterface */ foreach ($plugins as $plugin) { $definition = $plugin->getPluginDefinition(); // Many plugins expect a scalar value but the current value of the // pipeline might be multiple scalars (this is set by the previous // plugin) and in this case the current value needs to be iterated // and each scalar separately transformed. if ($multiple && !$definition['handle_multiples']) { $new_value = array(); if (!is_array($value)) { throw new MigrateException(sprintf('Pipeline failed for destination %s: %s got instead of an array,', $destination, $value)); } $break = FALSE; foreach ($value as $scalar_value) { try { $new_value[] = $plugin->transform($scalar_value, $this, $row, $destination); } catch (MigrateSkipProcessException $e) { $new_value[] = NULL; $break = TRUE; } } $value = $new_value; if ($break) { break; } } else { try { $value = $plugin->transform($value, $this, $row, $destination); } catch (MigrateSkipProcessException $e) { $value = NULL; break; } $multiple = $multiple || $plugin->multiple(); } } // No plugins or no value means do not set. if ($plugins && !is_null($value)) { $row->setDestinationProperty($destination, $value); } // Reset the value. $value = NULL; } }