FarmMigrateGetLab.php in farmOS 2.x
File
modules/core/migrate/src/Plugin/migrate/process/FarmMigrateGetLab.php
View source
<?php
namespace Drupal\farm_migrate\Plugin\migrate\process;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Row;
class FarmMigrateGetLab extends ProcessPluginBase {
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
$lab = $row
->get('field_farm_soil_lab');
if (empty($lab)) {
$lab = $row
->get('field_farm_water_lab');
}
$return = [];
if (!empty($lab)) {
$return[] = $lab;
}
return $return;
}
}