getFieldValues example

$language = ($row->get('i18n_mode') === '1') ? $default_language['language'] : $row->get('language');
    }

    $language = $language ?? $default_language['language'];
    $row->setSourceProperty('language', $language);

    // Get Field API field values.     foreach ($this->getFields('taxonomy_term', $vocabulary) as $field_name => $field) {
      // Ensure we're using the right language if the entity and the field are       // translatable.       $field_language = $entity_translatable && $field['translatable'] ? $language : NULL;
      $row->setSourceProperty($field_name$this->getFieldValues('taxonomy_term', $field_name$tid, NULL, $field_language));
    }

    // Find parents for this row.     $parents = $this->select('taxonomy_term_hierarchy', 'th')
      ->fields('th', ['parent', 'tid'])
      ->condition('tid', $row->getSourceProperty('tid'))
      ->execute()
      ->fetchCol();
    $row->setSourceProperty('parent', $parents);

    // Determine if this is a forum container.
/** * {@inheritdoc} */
  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);
  }

  /** * {@inheritdoc} */
  public function fields() {
    return [
      'entity_type' => $this->t('The entity type this translation relates to'),
      
    // migration.     $entity_translatable = $this->isEntityTranslatable('user');
    $source_language = $this->getEntityTranslationSourceLanguage('user', $uid);
    $language = $entity_translatable && $source_language ? $source_language : $row->getSourceProperty('language');
    $row->setSourceProperty('entity_language', $language);

    // Get Field API field values.     foreach ($this->getFields('user') as $field_name => $field) {
      // Ensure we're using the right language if the entity and the field are       // translatable.       $field_language = $entity_translatable && $field['translatable'] ? $language : NULL;
      $row->setSourceProperty($field_name$this->getFieldValues('user', $field_name$uid, NULL, $field_language));
    }

    // Get profile field values. This code is lifted directly from the D6     // ProfileFieldValues plugin.     if ($this->getDatabase()->schema()->tableExists('profile_value')) {
      $query = $this->select('profile_value', 'pv')
        ->fields('pv', ['fid', 'value']);
      $query->leftJoin('profile_field', 'pf', '[pf].[fid] = [pv].[fid]');
      $query->fields('pf', ['name', 'type']);
      $query->condition('uid', $row->getSourceProperty('uid'));
      $results = $query->execute();

      

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

    // Get Field API field values.     foreach ($this->getFields('taxonomy_term', $vocabulary) 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('taxonomy_term', $field_name$tid, NULL, $field_language));
    }

    // If the term name or term description were replaced by real fields using     // the Drupal 7 Title module, use the fields value instead of the term name     // or term description.     if ($this->moduleExists('title')) {
      $name_field = $row->getSourceProperty('name_field');
      if (isset($name_field[0]['value'])) {
        $row->setSourceProperty('name', $name_field[0]['value']);
      }
      $description_field = $row->getSourceProperty('description_field');
      

  public function prepareRow(Row $row) {
    $cid = $row->getSourceProperty('entity_id');
    $language = $row->getSourceProperty('language');
    $node_type = $row->getSourceProperty('node_type');
    $comment_type = 'comment_node_' . $node_type;

    // Get Field API field values.     foreach ($this->getFields('comment', $comment_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('comment', $field_name$cid, NULL, $field_language));
    }

    // If the comment subject was replaced by a real field using the Drupal 7     // Title module, use the field value instead of the comment subject.     if ($this->moduleExists('title')) {
      $subject_field = $row->getSourceProperty('subject_field');
      if (isset($subject_field[0]['value'])) {
        $row->setSourceProperty('subject', $subject_field[0]['value']);
      }
    }

    
    // The translations will be migrated by the d7_comment_entity_translation     // migration.     $entity_translatable = $this->isEntityTranslatable('comment') && (int) $this->variableGet('language_content_type_' . $node_type, 0) === 4;
    $source_language = $this->getEntityTranslationSourceLanguage('comment', $cid);
    $language = $entity_translatable && $source_language ? $source_language : $row->getSourceProperty('language');

    // Get Field API field values.     foreach ($this->getFields('comment', $comment_type) as $field_name => $field) {
      // Ensure we're using the right language if the entity and the field are       // translatable.       $field_language = $entity_translatable && $field['translatable'] ? $language : NULL;
      $row->setSourceProperty($field_name$this->getFieldValues('comment', $field_name$cid, NULL, $field_language));
    }

    // If the comment subject was replaced by a real field using the Drupal 7     // Title module, use the field value instead of the comment subject.     if ($this->moduleExists('title')) {
      $subject_field = $row->getSourceProperty('subject_field');
      if (isset($subject_field[0]['value'])) {
        $row->setSourceProperty('subject', $subject_field[0]['value']);
      }
    }

    
/** * {@inheritdoc} */
  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);
  }

  

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

    
    // using entity translation then set the language of this revision to the     // entity translation language.     if ($row->getSourceProperty('etr_created')) {
      $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 and the field are       // translatable.       $field_language = $entity_translatable && $field['translatable'] ? $language : NULL;
      $row->setSourceProperty($field_name$this->getFieldValues('node', $field_name$nid$vid$field_language));
    }

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

    // 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');
      
Home | Imprint | This part of the site doesn't use cookies.