public function SourcePluginBase::prepareRow in Drupal 9
Same name and namespace in other branches
- 8 core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php \Drupal\migrate\Plugin\migrate\source\SourcePluginBase::prepareRow()
- 10 core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php \Drupal\migrate\Plugin\migrate\source\SourcePluginBase::prepareRow()
Adds additional data to the row.
Parameters
\Drupal\migrate\Row $row: The row object.
Return value
bool FALSE if this row needs to be skipped.
Overrides MigrateSourceInterface::prepareRow
52 calls to SourcePluginBase::prepareRow()
- Action::prepareRow in core/
modules/ action/ src/ Plugin/ migrate/ source/ Action.php - Adds additional data to the row.
- Block::prepareRow in core/
modules/ block/ src/ Plugin/ migrate/ source/ Block.php - Adds additional data to the row.
- BlockCustomTranslation::prepareRow in core/
modules/ block_content/ src/ Plugin/ migrate/ source/ d7/ BlockCustomTranslation.php - Adds additional data to the row.
- BlockTranslation::prepareRow in core/
modules/ block/ src/ Plugin/ migrate/ source/ d6/ BlockTranslation.php - Adds additional data to the row.
- Comment::prepareRow in core/
modules/ comment/ src/ Plugin/ migrate/ source/ d6/ Comment.php - Adds additional data to the row.
50 methods override SourcePluginBase::prepareRow()
- Action::prepareRow in core/
modules/ action/ src/ Plugin/ migrate/ source/ Action.php - Adds additional data to the row.
- Block::prepareRow in core/
modules/ block/ src/ Plugin/ migrate/ source/ Block.php - Adds additional data to the row.
- BlockCustomTranslation::prepareRow in core/
modules/ block_content/ src/ Plugin/ migrate/ source/ d7/ BlockCustomTranslation.php - Adds additional data to the row.
- Comment::prepareRow in core/
modules/ comment/ src/ Plugin/ migrate/ source/ d6/ Comment.php - Adds additional data to the row.
- Comment::prepareRow in core/
modules/ comment/ src/ Plugin/ migrate/ source/ d7/ Comment.php - Adds additional data to the row.
File
- core/
modules/ migrate/ src/ Plugin/ migrate/ source/ SourcePluginBase.php, line 292
Class
- SourcePluginBase
- The base class for source plugins.
Namespace
Drupal\migrate\Plugin\migrate\sourceCode
public function prepareRow(Row $row) {
$result = TRUE;
try {
$result_hook = $this
->getModuleHandler()
->invokeAll('migrate_prepare_row', [
$row,
$this,
$this->migration,
]);
$result_named_hook = $this
->getModuleHandler()
->invokeAll('migrate_' . $this->migration
->id() . '_prepare_row', [
$row,
$this,
$this->migration,
]);
// We will skip if any hook returned FALSE.
$skip = $result_hook && in_array(FALSE, $result_hook) || $result_named_hook && in_array(FALSE, $result_named_hook);
$save_to_map = TRUE;
} catch (MigrateSkipRowException $e) {
$skip = TRUE;
$save_to_map = $e
->getSaveToMap();
if ($message = trim($e
->getMessage())) {
$this->idMap
->saveMessage($row
->getSourceIdValues(), $message, MigrationInterface::MESSAGE_INFORMATIONAL);
}
}
// We're explicitly skipping this row - keep track in the map table.
if ($skip) {
// Make sure we replace any previous messages for this item with any
// new ones.
if ($save_to_map) {
$this->idMap
->saveIdMapping($row, [], MigrateIdMapInterface::STATUS_IGNORED);
$this->currentRow = NULL;
$this->currentSourceIds = NULL;
}
$result = FALSE;
}
elseif ($this->trackChanges) {
// When tracking changed data, We want to quietly skip (rather than
// "ignore") rows with changes. The caller needs to make that decision,
// so we need to provide them with the necessary information (before and
// after hashes).
$row
->rehash();
}
return $result;
}