You are here

public function Migration::getProcessPlugins in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/migrate/src/Plugin/Migration.php \Drupal\migrate\Plugin\Migration::getProcessPlugins()
  2. 10 core/modules/migrate/src/Plugin/Migration.php \Drupal\migrate\Plugin\Migration::getProcessPlugins()

Returns the process plugins.

Parameters

array $process: A process configuration array.

Return value

\Drupal\migrate\Plugin\MigrateProcessInterface[][] An associative array. The keys are the destination property names. Values are process pipelines. Each pipeline contains an array of plugins.

Overrides MigrationInterface::getProcessPlugins

File

core/modules/migrate/src/Plugin/Migration.php, line 339

Class

Migration
Defines the Migration plugin.

Namespace

Drupal\migrate\Plugin

Code

public function getProcessPlugins(array $process = NULL) {
  if (!isset($process)) {
    $process = $this
      ->getProcess();
  }
  $index = serialize($process);
  if (!isset($this->processPlugins[$index])) {
    $this->processPlugins[$index] = [];
    foreach ($this
      ->getProcessNormalized($process) as $property => $configurations) {
      $this->processPlugins[$index][$property] = [];
      foreach ($configurations as $configuration) {
        if (isset($configuration['source'])) {
          $this->processPlugins[$index][$property][] = $this->processPluginManager
            ->createInstance('get', $configuration, $this);
        }

        // Get is already handled.
        if ($configuration['plugin'] != 'get') {
          $this->processPlugins[$index][$property][] = $this->processPluginManager
            ->createInstance($configuration['plugin'], $configuration, $this);
        }
        if (!$this->processPlugins[$index][$property]) {
          throw new MigrateException("Invalid process configuration for {$property}");
        }
      }
    }
  }
  return $this->processPlugins[$index];
}