Created
September 3, 2020 18:23
-
-
Save chriscalip/605ef45a4a17d0aef5eaca49a0fe1747 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\rl_migrates\Plugin\migrate\process; | |
use Drupal\migrate\MigrateExecutableInterface; | |
use Drupal\migrate\ProcessPluginBase; | |
use Drupal\migrate\Row; | |
use Drupal\migrate\MigrateSkipRowException; | |
/** | |
* Debug are us. | |
* | |
* @code | |
* process: | |
* field_xxx: | |
* plugin: rl_debug | |
* addSource: 1 | |
* forceSkip: 1 | |
* @endcode | |
* | |
* @MigrateProcessPlugin( | |
* id = "rl_debug", | |
* ) | |
*/ | |
class RlDebug extends ProcessPluginBase { | |
/** | |
* {@inheritdoc} | |
*/ | |
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { | |
$debugOutput = []; | |
$debugOutput[] = 'rl_debug'; | |
$debugOutput[] = $value; | |
if (!empty($this->configuration['addSource'])) { | |
$debugOutput[] = $row->getSource(); | |
} | |
drush_print_r($debugOutput); | |
if (!empty($this->configuration['forceSkip'])) { | |
throw new MigrateSkipRowException('rl_debug forceSkip'); | |
} | |
return $value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment