Skip to content

Instantly share code, notes, and snippets.

@liberatr
Last active August 28, 2021 00:08
Show Gist options
  • Save liberatr/9e47e040ea7fc8c519857036e82318f6 to your computer and use it in GitHub Desktop.
Save liberatr/9e47e040ea7fc8c519857036e82318f6 to your computer and use it in GitHub Desktop.
A Drupal 8 migrate processor plugin for debugging
<?php
namespace Drupal\uwec_migration\Plugin\migrate\process;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\Row;
/**
* This plugin allows your migration to spit the value to the command line.
*
* Usage, sends back an array of values:
*
* process:
* field_semesters:
* plugin: debug
* source: semesters
* Where "semesters" is the name of your source field, and "field_semesters" is the name
* of the Drupal select field.
*
* @MigrateProcessPlugin(
* id = "debug"
* )
*/
class Debug extends ProcessPluginBase {
/**
* {@inheritdoc}
*/
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
print_r($value);
return $value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment