function Migration::getProcessPlugins

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

Returns the process plugins.

Parameters

array|null $process: (Optional) A process configuration array. Defaults to NULL. If specified, then the plugins from the given process array are returned. If not specified, then the plugins from this migration's process array are returned.

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 386

Class

Migration
Defines the Migration plugin.

Namespace

Drupal\migrate\Plugin

Code

public function getProcessPlugins(?array $process = NULL) {
  $process = isset($process) ? $this->getProcessNormalized($process) : $this->getProcess();
  $index = serialize($process);
  if (!isset($this->processPlugins[$index])) {
    $this->processPlugins[$index] = [];
    foreach ($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];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.