function UserEntityTranslation::prepareRow

Same name in other branches
  1. 9 core/modules/user/src/Plugin/migrate/source/d7/UserEntityTranslation.php \Drupal\user\Plugin\migrate\source\d7\UserEntityTranslation::prepareRow()
  2. 10 core/modules/user/src/Plugin/migrate/source/d7/UserEntityTranslation.php \Drupal\user\Plugin\migrate\source\d7\UserEntityTranslation::prepareRow()
  3. 11.x core/modules/user/src/Plugin/migrate/source/d7/UserEntityTranslation.php \Drupal\user\Plugin\migrate\source\d7\UserEntityTranslation::prepareRow()

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

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