You are here

public function Node::prepareRow in Drupal 9

Same name in this branch
  1. 9 core/modules/node/src/Plugin/migrate/source/d6/Node.php \Drupal\node\Plugin\migrate\source\d6\Node::prepareRow()
  2. 9 core/modules/node/src/Plugin/migrate/source/d7/Node.php \Drupal\node\Plugin\migrate\source\d7\Node::prepareRow()
Same name and namespace in other branches
  1. 8 core/modules/node/src/Plugin/migrate/source/d6/Node.php \Drupal\node\Plugin\migrate\source\d6\Node::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 SourcePluginBase::prepareRow

File

core/modules/node/src/Plugin/migrate/source/d6/Node.php, line 186

Class

Node
Drupal 6 node source from database.

Namespace

Drupal\node\Plugin\migrate\source\d6

Code

public function prepareRow(Row $row) {

  // format = 0 can happen when the body field is hidden. Set the format to 1
  // to avoid migration map issues (since the body field isn't used anyway).
  if ($row
    ->getSourceProperty('format') === '0') {
    $row
      ->setSourceProperty('format', $this->filterDefaultFormat);
  }
  if ($this
    ->moduleExists('content') && $this
    ->getModuleSchemaVersion('content') >= 6001) {
    foreach ($this
      ->getFieldValues($row) as $field => $values) {
      $row
        ->setSourceProperty($field, $values);
    }
  }

  // Make sure we always have a translation set.
  if ($row
    ->getSourceProperty('tnid') == 0) {
    $row
      ->setSourceProperty('tnid', $row
      ->getSourceProperty('nid'));
  }
  return parent::prepareRow($row);
}