diff --git a/core/modules/migrate/src/Entity/Migration.php b/core/modules/migrate/src/Entity/Migration.php index f07ba40..78a0605 100644 --- a/core/modules/migrate/src/Entity/Migration.php +++ b/core/modules/migrate/src/Entity/Migration.php @@ -407,13 +407,23 @@ public function setProcess(array $process) { /** * {@inheritdoc} */ - public function setProcessOfProperty($field_name, $process, $merge = TRUE) { - if (isset($this->process[$field_name]) && is_array($process) && $merge) { + public function setProcessOfProperty($field_name, $process) { + $this->process[$field_name] = $process; + } + + /** + * {@inheritdoc} + */ + public function mergeProcessOfProperty($field_name, array $process) { + // If we already have a process value then merge the incoming process array + //otherwise simply set it. + if (isset($this->process[$field_name])) { $this->process = NestedArray::mergeDeepArray([$this->process, [$field_name => $process]], TRUE); } else { - $this->process[$field_name] = $process; + $this->setProcessOfProperty($field_name, $process); } + return $this; } diff --git a/core/modules/migrate/src/Entity/MigrationInterface.php b/core/modules/migrate/src/Entity/MigrationInterface.php index ca9ac03..fc575a2 100644 --- a/core/modules/migrate/src/Entity/MigrationInterface.php +++ b/core/modules/migrate/src/Entity/MigrationInterface.php @@ -202,17 +202,30 @@ public function setProcess(array $process); * * @param string $field_name * The field name of which to set the process. + * @param mixed $process + * A valid process value, array or string. + * + * @return $this + * The migration entity. + * + * @see Drupal\migrate_drupal\Plugin\migrate\load\LoadEntity::processLinkField(). + */ + public function setProcessOfProperty($field_name, $process); + + /** + * Merge the process arrays for an individual field. + * + * @param string $field_name + * The field name of which to set the process. * @param array $process * An array of process data. - * @param boolean $merge - * (optional) TRUE if we should merge the process arrays otherwise FALSE. * * @return $this * The migration entity. * * @see Drupal\migrate_drupal\Plugin\migrate\load\LoadEntity::processLinkField(). */ - public function setProcessOfProperty($field_name, $process, $merge = TRUE); + public function mergeProcessOfProperty($field_name, array $process); /** * Get the current system of record of the migration. diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/load/LoadEntity.php b/core/modules/migrate_drupal/src/Plugin/migrate/load/LoadEntity.php index 7de8883..f04672d 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/load/LoadEntity.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/load/LoadEntity.php @@ -150,7 +150,7 @@ protected function processTextField($field_name, $field_data, MigrationInterface 'source' => $format_key, ], ]; - $migration->setProcessOfProperty("$field_name/format", $process); + $migration->mergeProcessOfProperty("$field_name/format", $process); } /** @@ -172,7 +172,7 @@ protected function processFileField($field_name, $field_data, MigrationInterface $field_name . '_data', ], ]; - $migration->setProcessOfProperty($field_name, $process); + $migration->mergeProcessOfProperty($field_name, $process); } /** @@ -196,7 +196,7 @@ protected function processLinkField($field_name, $field_data, MigrationInterface $field_name . '_attributes', ], ]; - $migration->setProcessOfProperty($field_name, $process); + $migration->mergeProcessOfProperty($field_name, $process); } }