Same name and namespace in other branches
- 8.9.x core/modules/migrate/src/Plugin/migrate/process/SkipOnEmpty.php \Drupal\migrate\Plugin\migrate\process\SkipOnEmpty
- 9 core/modules/migrate/src/Plugin/migrate/process/SkipOnEmpty.php \Drupal\migrate\Plugin\migrate\process\SkipOnEmpty
Hierarchy
- class \Drupal\migrate\Plugin\migrate\process\SkipOnEmpty extends \Drupal\migrate\ProcessPluginBase
Expanded class hierarchy of SkipOnEmpty
1 file declares its use of SkipOnEmpty
- SkipOnEmptyTest.php in core/
modules/ migrate/ tests/ src/ Unit/ process/ SkipOnEmptyTest.php
File
- core/
modules/ migrate/ src/ Plugin/ migrate/ process/ SkipOnEmpty.php, line 79
Namespace
Drupal\migrate\Plugin\migrate\processView source
class SkipOnEmpty extends ProcessPluginBase {
/**
* Skips the current row when value is not set.
*
* @param mixed $value
* The input value.
* @param \Drupal\migrate\MigrateExecutableInterface $migrate_executable
* The migration in which this process is being executed.
* @param \Drupal\migrate\Row $row
* The row from the source to process.
* @param string $destination_property
* The destination property currently worked on. This is only used together
* with the $row above.
*
* @return mixed
* The input value, $value, if it is not empty.
*
* @throws \Drupal\migrate\MigrateSkipRowException
* Thrown if the source property is not set and the row should be skipped,
* records with STATUS_IGNORED status in the map.
*/
public function row($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
if (!$value) {
$message = !empty($this->configuration['message']) ? $this->configuration['message'] : '';
throw new MigrateSkipRowException($message);
}
return $value;
}
/**
* Stops processing the current property when value is not set.
*
* @param mixed $value
* The input value.
* @param \Drupal\migrate\MigrateExecutableInterface $migrate_executable
* The migration in which this process is being executed.
* @param \Drupal\migrate\Row $row
* The row from the source to process.
* @param string $destination_property
* The destination property currently worked on. This is only used together
* with the $row above.
*
* @return mixed
* The input value, $value, if it is not empty.
*/
public function process($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
if (!$value) {
$this
->stopPipeline();
return NULL;
}
return $value;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SkipOnEmpty:: |
public | function | Stops processing the current property when value is not set. | |
SkipOnEmpty:: |
public | function | Skips the current row when value is not set. |