public function NodeEntityTranslation::prepareRow in Drupal 10
Same name and namespace in other branches
- 8 core/modules/node/src/Plugin/migrate/source/d7/NodeEntityTranslation.php \Drupal\node\Plugin\migrate\source\d7\NodeEntityTranslation::prepareRow()
- 9 core/modules/node/src/Plugin/migrate/source/d7/NodeEntityTranslation.php \Drupal\node\Plugin\migrate\source\d7\NodeEntityTranslation::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/ d7/ NodeEntityTranslation.php, line 80
Class
- NodeEntityTranslation
- Drupal 7 node entity translations source from database.
Namespace
Drupal\node\Plugin\migrate\source\d7Code
public function prepareRow(Row $row) {
$nid = $row
->getSourceProperty('entity_id');
$vid = $row
->getSourceProperty('revision_id');
$type = $row
->getSourceProperty('type');
$language = $row
->getSourceProperty('language');
// Get Field API field values.
foreach ($this
->getFields('node', $type) as $field_name => $field) {
// Ensure we're using the right language if the entity is translatable.
$field_language = $field['translatable'] ? $language : NULL;
$row
->setSourceProperty($field_name, $this
->getFieldValues('node', $field_name, $nid, $vid, $field_language));
}
// If the node title was replaced by a real field using the Drupal 7 Title
// module, use the field value instead of the node title.
if ($this
->moduleExists('title')) {
$title_field = $row
->getSourceProperty('title_field');
if (isset($title_field[0]['value'])) {
$row
->setSourceProperty('title', $title_field[0]['value']);
}
}
return parent::prepareRow($row);
}