You are here

public function SourcePluginBase::prepareRow in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php \Drupal\migrate\Plugin\migrate\source\SourcePluginBase::prepareRow()

Add 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

34 calls to SourcePluginBase::prepareRow()
Block::prepareRow in core/modules/block/src/Plugin/migrate/source/Block.php
Add additional data to the row.
Comment::prepareRow in core/modules/comment/src/Plugin/migrate/source/d6/Comment.php
Add additional data to the row.
Comment::prepareRow in core/modules/comment/src/Plugin/migrate/source/d7/Comment.php
Add additional data to the row.
CommentType::prepareRow in core/modules/comment/src/Plugin/migrate/source/d7/CommentType.php
Add additional data to the row.
ContactCategory::prepareRow in core/modules/contact/src/Plugin/migrate/source/ContactCategory.php
Add additional data to the row.

... See full list

33 methods override SourcePluginBase::prepareRow()
Block::prepareRow in core/modules/block/src/Plugin/migrate/source/Block.php
Add additional data to the row.
Comment::prepareRow in core/modules/comment/src/Plugin/migrate/source/d6/Comment.php
Add additional data to the row.
Comment::prepareRow in core/modules/comment/src/Plugin/migrate/source/d7/Comment.php
Add additional data to the row.
CommentType::prepareRow in core/modules/comment/src/Plugin/migrate/source/d7/CommentType.php
Add additional data to the row.
ContactCategory::prepareRow in core/modules/contact/src/Plugin/migrate/source/ContactCategory.php
Add additional data to the row.

... See full list

File

core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php, line 176
Contains \Drupal\migrate\Plugin\migrate\source\SourcePluginBase.

Class

SourcePluginBase
The base class for all 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', array(
      $row,
      $this,
      $this->migration,
    ));
    $result_named_hook = $this
      ->getModuleHandler()
      ->invokeAll('migrate_' . $this->migration
      ->id() . '_prepare_row', array(
      $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();
  }

  // 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, array(), 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;
}