public function MigrationPluginsAlterer::paragraphsMigrationPrepareProcess

Converts a migration process to array for adding another process elements.

Parameters

array $process: The array of process definitions of a migration.

string $property: The property which process definition should me converted to an array of process definitions.

Return value

bool TRUE when the action was successful, FALSE otherwise.

2 calls to MigrationPluginsAlterer::paragraphsMigrationPrepareProcess()
MigrationPluginsAlterer::paragraphsMigrationBundleAdjust in paragraphs/src/MigrationPluginsAlterer.php
Remove 'field_' prefix from field collection bundles.
MigrationPluginsAlterer::paragraphsMigrationEntityTypeAdjust in paragraphs/src/MigrationPluginsAlterer.php
Map field_collection_item and 'paragraphs_item' fields to 'paragraph'.

File

paragraphs/src/MigrationPluginsAlterer.php, line 120

Class

MigrationPluginsAlterer
Class MigrationPluginsAlterer.

Namespace

Drupal\paragraphs

Code

public function paragraphsMigrationPrepareProcess(array &$process, $property) : bool {
  if (!isset($process[$property])) {
    return FALSE;
  }
  $process_element =& $process[$property];

  // Try to play with other modules altering this, and don't replace it
  // outright unless it's unchanged.
  if (is_string($process_element)) {
    $process_element = [
      [
        'plugin' => 'get',
        'source' => $process_element,
      ],
    ];
  }
  elseif (is_array($process_element) && array_key_exists('plugin', $process_element)) {
    $process_element = [
      $process_element,
    ];
  }
  if (!is_array($process_element)) {
    $this->loggerChannel
      ->error('Unknown migration process element type: @type.', [
      '@type' => gettype($process_element),
    ]);
    return FALSE;
  }
  return TRUE;
}