SuggestedProducts.php in Commerce Migrate 3.1.x
File
modules/csv_example/src/Plugin/migrate/process/SuggestedProducts.php
View source
<?php
namespace Drupal\commerce_migrate_csv_example\Plugin\migrate\process;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\Row;
class SuggestedProducts extends ProcessPluginBase {
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
$ret = [];
if (is_array($value)) {
foreach ($value as $suggested) {
if (!empty($suggested)) {
$ret[] = [
$suggested,
];
}
}
}
return $ret;
}
}