3 namespace Drupal\migrate;
5 use Drupal\Core\Plugin\PluginBase;
6 use Drupal\migrate\Plugin\MigrateProcessInterface;
9 * The base class for all migrate process plugins.
11 * Migrate process plugins are taking a value and transform them. For example,
12 * transform a human provided name into a machine name, look up an identifier
13 * in a previous migration and so on.
15 * @see https://www.drupal.org/node/2129651
16 * @see \Drupal\migrate\Plugin\MigratePluginManager
17 * @see \Drupal\migrate\Plugin\MigrateProcessInterface
18 * @see \Drupal\migrate\Annotation\MigrateProcessPlugin
23 abstract class ProcessPluginBase extends PluginBase implements MigrateProcessInterface {
28 public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
29 // Do not call this method from children.
30 if (isset($this->configuration['method'])) {
31 if (method_exists($this, $this->configuration['method'])) {
32 return $this->{$this->configuration['method']}($value, $migrate_executable, $row, $destination_property);
34 throw new \BadMethodCallException(sprintf('The %s method does not exist in the %s plugin.', $this->configuration['method'], $this->pluginId));
37 throw new \BadMethodCallException(sprintf('The "method" key in the plugin configuration must to be set for the %s plugin.', $this->pluginId));
44 public function multiple() {