You are here

public function UserEntityTranslation::prepareRow in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/user/src/Plugin/migrate/source/d7/UserEntityTranslation.php \Drupal\user\Plugin\migrate\source\d7\UserEntityTranslation::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/user/src/Plugin/migrate/source/d7/UserEntityTranslation.php, line 33

Class

UserEntityTranslation
Provides Drupal 7 user entity translations source plugin.

Namespace

Drupal\user\Plugin\migrate\source\d7

Code

public function prepareRow(Row $row) {
  $uid = $row
    ->getSourceProperty('entity_id');
  $language = $row
    ->getSourceProperty('language');

  // Get Field API field values.
  foreach ($this
    ->getFields('user') 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('user', $field_name, $uid, NULL, $field_language));
  }
  return parent::prepareRow($row);
}