function Node::prepareRow

Same name in this branch
  1. 11.x 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. 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()
  3. 8.9.x core/modules/node/src/Plugin/migrate/source/d6/Node.php \Drupal\node\Plugin\migrate\source\d6\Node::prepareRow()
  4. 8.9.x core/modules/node/src/Plugin/migrate/source/d7/Node.php \Drupal\node\Plugin\migrate\source\d7\Node::prepareRow()
  5. 10 core/modules/node/src/Plugin/migrate/source/d6/Node.php \Drupal\node\Plugin\migrate\source\d6\Node::prepareRow()
  6. 10 core/modules/node/src/Plugin/migrate/source/d7/Node.php \Drupal\node\Plugin\migrate\source\d7\Node::prepareRow()

Overrides SourcePluginBase::prepareRow

File

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

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.