annotate core/modules/migrate/src/Plugin/MigrateProcessInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents c2387f117808
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\migrate\Plugin;
Chris@0 4
Chris@0 5 use Drupal\Component\Plugin\PluginInspectionInterface;
Chris@0 6 use Drupal\migrate\MigrateExecutableInterface;
Chris@0 7 use Drupal\migrate\Row;
Chris@0 8
Chris@0 9 /**
Chris@0 10 * An interface for migrate process plugins.
Chris@0 11 *
Chris@16 12 * A process plugin will typically implement the transform() method to perform
Chris@16 13 * its work. However, it is possible instead for a process plugin to use any
Chris@16 14 * number of methods, thus offering different alternatives ways of processing.
Chris@16 15 * In this case, the transform() method should not be implemented, and the
Chris@16 16 * plugin configuration must provide the name of the method to be called via the
Chris@16 17 * "method" key. Each method must have the same signature as transform().
Chris@16 18 * The base class \Drupal\migrate\ProcessPluginBase takes care of implementing
Chris@16 19 * transform() and calling the configured method. See
Chris@16 20 * \Drupal\migrate\Plugin\migrate\process\SkipOnEmpty and
Chris@16 21 * d6_field_instance_widget_settings.yml for examples.
Chris@0 22 *
Chris@0 23 * @see \Drupal\migrate\Plugin\MigratePluginManager
Chris@0 24 * @see \Drupal\migrate\ProcessPluginBase
Chris@0 25 * @see \Drupal\migrate\Annotation\MigrateProcessPlugin
Chris@0 26 * @see plugin_api
Chris@0 27 *
Chris@0 28 * @ingroup migration
Chris@0 29 */
Chris@0 30 interface MigrateProcessInterface extends PluginInspectionInterface {
Chris@0 31
Chris@0 32 /**
Chris@0 33 * Performs the associated process.
Chris@0 34 *
Chris@0 35 * @param mixed $value
Chris@0 36 * The value to be transformed.
Chris@0 37 * @param \Drupal\migrate\MigrateExecutableInterface $migrate_executable
Chris@0 38 * The migration in which this process is being executed.
Chris@0 39 * @param \Drupal\migrate\Row $row
Chris@0 40 * The row from the source to process. Normally, just transforming the value
Chris@0 41 * is adequate but very rarely you might need to change two columns at the
Chris@0 42 * same time or something like that.
Chris@0 43 * @param string $destination_property
Chris@0 44 * The destination property currently worked on. This is only used together
Chris@0 45 * with the $row above.
Chris@0 46 *
Chris@0 47 * @return string|array
Chris@0 48 * The newly transformed value.
Chris@0 49 */
Chris@0 50 public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property);
Chris@0 51
Chris@0 52 /**
Chris@0 53 * Indicates whether the returned value requires multiple handling.
Chris@0 54 *
Chris@0 55 * @return bool
Chris@0 56 * TRUE when the returned value contains a list of values to be processed.
Chris@0 57 * For example, when the 'source' property is a string and the value found
Chris@0 58 * is an array.
Chris@0 59 */
Chris@0 60 public function multiple();
Chris@0 61
Chris@0 62 }