You are here

public function ProcessPluginBase::transform in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/src/ProcessPluginBase.php \Drupal\migrate\ProcessPluginBase::transform()
  2. 9 core/modules/migrate/src/ProcessPluginBase.php \Drupal\migrate\ProcessPluginBase::transform()

Performs the associated process.

Parameters

mixed $value: The value to be transformed.

\Drupal\migrate\MigrateExecutableInterface $migrate_executable: The migration in which this process is being executed.

\Drupal\migrate\Row $row: The row from the source to process. Normally, just transforming the value is adequate but very rarely you might need to change two columns at the same time or something like that.

string $destination_property: The destination property currently worked on. This is only used together with the $row above.

Return value

mixed The newly transformed value.

Overrides MigrateProcessInterface::transform

49 methods override ProcessPluginBase::transform()
ArrayBuild::transform in core/modules/migrate/src/Plugin/migrate/process/ArrayBuild.php
Performs the associated process.
BlockPluginId::transform in core/modules/block/src/Plugin/migrate/process/BlockPluginId.php
Set the block plugin id.
BlockSettings::transform in core/modules/block/src/Plugin/migrate/process/BlockSettings.php
Set the block configuration.
BlockTheme::transform in core/modules/block/src/Plugin/migrate/process/BlockTheme.php
Performs the associated process.
BlockVisibility::transform in core/modules/block/src/Plugin/migrate/process/BlockVisibility.php
Performs the associated process.

... See full list

File

core/modules/migrate/src/ProcessPluginBase.php, line 36

Class

ProcessPluginBase
The base class for all migrate process plugins.

Namespace

Drupal\migrate

Code

public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {

  // Do not call this method from children.
  if (isset($this->configuration['method'])) {
    if (method_exists($this, $this->configuration['method'])) {
      return $this
        ->{$this->configuration['method']}($value, $migrate_executable, $row, $destination_property);
    }
    throw new \BadMethodCallException(sprintf('The %s method does not exist in the %s plugin.', $this->configuration['method'], $this->pluginId));
  }
  else {
    throw new \BadMethodCallException(sprintf('The "method" key in the plugin configuration must to be set for the %s plugin.', $this->pluginId));
  }
}