8.5.x SourcePluginBase.php SourcePluginBase::prepareRow(Row $row)
8.0.x SourcePluginBase.php SourcePluginBase::prepareRow(Row $row)
8.1.x SourcePluginBase.php SourcePluginBase::prepareRow(Row $row)
8.2.x SourcePluginBase.php SourcePluginBase::prepareRow(Row $row)
8.3.x SourcePluginBase.php SourcePluginBase::prepareRow(Row $row)
8.4.x SourcePluginBase.php SourcePluginBase::prepareRow(Row $row)
8.6.x SourcePluginBase.php SourcePluginBase::prepareRow(Row $row)

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

33 calls to SourcePluginBase::prepareRow()
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.
CommentType::prepareRow in core/modules/comment/src/Plugin/migrate/source/d7/CommentType.php
Adds additional data to the row.
Field::prepareRow in core/modules/field/src/Plugin/migrate/source/d6/Field.php
Adds additional data to the row.
Field::prepareRow in core/modules/field/src/Plugin/migrate/source/d7/Field.php
Adds additional data to the row.

... See full list

40 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.
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.
CommentType::prepareRow in core/modules/comment/src/Plugin/migrate/source/d7/CommentType.php
Adds additional data to the row.

... See full list

File

core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php, line 240

Class

SourcePluginBase
The base class for source plugins.

Namespace

Drupal\migrate\Plugin\migrate\source

Code

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;
}