SkipOnEmpty.php in Zircon Profile 8
Same filename and directory in other branches
Namespace
Drupal\migrate\Plugin\migrate\processFile
core/modules/migrate/src/Plugin/migrate/process/SkipOnEmpty.phpView source
<?php
/**
* @file
* Contains \Drupal\migrate\Plugin\migrate\process\SkipOnEmpty.
*/
namespace Drupal\migrate\Plugin\migrate\process;
use Drupal\migrate\MigrateSkipProcessException;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Row;
use Drupal\migrate\MigrateSkipRowException;
/**
* If the source evaluates to empty, we skip processing or the whole row.
*
* @MigrateProcessPlugin(
* id = "skip_on_empty"
* )
*/
class SkipOnEmpty extends ProcessPluginBase {
/**
* {@inheritdoc}
*/
public function row($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
if (!$value) {
throw new MigrateSkipRowException();
}
return $value;
}
/**
* {@inheritdoc}
*/
public function process($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
if (!$value) {
throw new MigrateSkipProcessException();
}
return $value;
}
}
Classes
Name | Description |
---|---|
SkipOnEmpty | If the source evaluates to empty, we skip processing or the whole row. |