function VocabularyTranslation::query

Same name in this branch
  1. 9 core/modules/taxonomy/src/Plugin/migrate/source/d6/VocabularyTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d6\VocabularyTranslation::query()
Same name in other branches
  1. 8.9.x core/modules/taxonomy/src/Plugin/migrate/source/d6/VocabularyTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d6\VocabularyTranslation::query()
  2. 8.9.x core/modules/taxonomy/src/Plugin/migrate/source/d7/VocabularyTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d7\VocabularyTranslation::query()
  3. 10 core/modules/taxonomy/src/Plugin/migrate/source/d6/VocabularyTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d6\VocabularyTranslation::query()
  4. 10 core/modules/taxonomy/src/Plugin/migrate/source/d7/VocabularyTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d7\VocabularyTranslation::query()
  5. 11.x core/modules/taxonomy/src/Plugin/migrate/source/d6/VocabularyTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d6\VocabularyTranslation::query()
  6. 11.x core/modules/taxonomy/src/Plugin/migrate/source/d7/VocabularyTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d7\VocabularyTranslation::query()

Overrides Vocabulary::query

File

core/modules/taxonomy/src/Plugin/migrate/source/d7/VocabularyTranslation.php, line 23

Class

VocabularyTranslation
Drupal 7 i18n vocabulary translations source from database.

Namespace

Drupal\taxonomy\Plugin\migrate\source\d7

Code

public function query() {
    $query = parent::query();
    $query->leftjoin('i18n_string', 'i18n', 'CAST ([v].[vid] AS CHAR(222)) = [i18n].[objectid]');
    $query->innerJoin('locales_target', 'lt', '[lt].[lid] = [i18n].[lid]');
    $query->condition('type', 'vocabulary')
        ->fields('lt')
        ->fields('i18n');
    $query->addField('lt', 'lid', 'lt_lid');
    if ($this->getDatabase()
        ->schema()
        ->fieldExists('taxonomy_vocabulary', 'language')) {
        $query->addField('v', 'language', 'v_language');
    }
    if ($this->getDatabase()
        ->schema()
        ->fieldExists('taxonomy_vocabulary', 'i18n_mode')) {
        $query->addField('v', 'i18n_mode');
    }
    return $query;
}

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