isEntityTranslatable example

->condition('ur.uid', $uid)
      ->execute()
      ->fetchCol();
    $row->setSourceProperty('roles', $roles);

    $row->setSourceProperty('data', unserialize($row->getSourceProperty('data') ?? ''));

    // If this entity was translated using Entity Translation, we need to get     // its source language to get the field values in the right language.     // The translations will be migrated by the d7_user_entity_translation     // 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));
    }

    

  public function prepareRow(Row $row) {
    $nid = $row->getSourceProperty('nid');
    $vid = $row->getSourceProperty('vid');
    $type = $row->getSourceProperty('type');

    // If this entity was translated using Entity Translation, we need to get     // its source language to get the field values in the right language.     // The translations will be migrated by the d7_node_entity_translation     // migration.     $entity_translatable = $this->isEntityTranslatable('node') && (int) $this->variableGet('language_content_type_' . $type, 0) === 4;
    $source_language = $this->getEntityTranslationSourceLanguage('node', $nid);
    $language = $entity_translatable && $source_language ? $source_language : $row->getSourceProperty('language');

    // If this is using d7_node_complete source plugin and this is a node     // 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.

  public function prepareRow(Row $row) {
    $tid = $row->getSourceProperty('tid');
    $vocabulary = $row->getSourceProperty('machine_name');
    $default_language = (array) $this->variableGet('language_default', ['language' => 'en']);

    // If this entity was translated using Entity Translation, we need to get     // its source language to get the field values in the right language.     // The translations will be migrated by the d7_node_entity_translation     // migration.     $translatable_vocabularies = array_keys(array_filter($this->variableGet('entity_translation_taxonomy', [])));
    $entity_translatable = $this->isEntityTranslatable('taxonomy_term') && in_array($vocabulary$translatable_vocabularies, TRUE);

    if ($entity_translatable) {
      $source_language = $this->getEntityTranslationSourceLanguage('taxonomy_term', $tid);
      $language = $entity_translatable && $source_language ? $source_language : $default_language['language'];
    }
    // If this is an i18n translation use the default language when i18n_mode     // is localized.     if ($row->get('i18n_mode')) {
      $language = ($row->get('i18n_mode') === '1') ? $default_language['language'] : $row->get('language');
    }

    
public function prepareRow(Row $row) {
    $cid = $row->getSourceProperty('cid');

    $node_type = $row->getSourceProperty('node_type');
    $comment_type = 'comment_node_' . $node_type;
    $row->setSourceProperty('comment_type', 'comment_node_' . $node_type);

    // If this entity was translated using Entity Translation, we need to get     // its source language to get the field values in the right language.     // 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));
    }

    
Home | Imprint | This part of the site doesn't use cookies.