X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ftaxonomy%2Fsrc%2FPlugin%2Fmigrate%2Fsource%2Fd6%2FVocabularyTranslation.php;fp=web%2Fcore%2Fmodules%2Ftaxonomy%2Fsrc%2FPlugin%2Fmigrate%2Fsource%2Fd6%2FVocabularyTranslation.php;h=a6edd05e94cd18c4469266efc9b02eef1ce92d78;hp=0000000000000000000000000000000000000000;hb=bfbba508964731508b9bd6d5835c2edc858db95b;hpb=cb9a80db11fc6b014e5b1e693a5a391c95eb5d9a diff --git a/web/core/modules/taxonomy/src/Plugin/migrate/source/d6/VocabularyTranslation.php b/web/core/modules/taxonomy/src/Plugin/migrate/source/d6/VocabularyTranslation.php new file mode 100644 index 000000000..a6edd05e9 --- /dev/null +++ b/web/core/modules/taxonomy/src/Plugin/migrate/source/d6/VocabularyTranslation.php @@ -0,0 +1,57 @@ +select('vocabulary', 'v') + ->fields('v', ['vid', 'name', 'description']) + ->fields('i18n', ['lid', 'type', 'property', 'objectid']) + ->fields('lt', ['lid', 'translation']) + ->condition('i18n.type', 'vocabulary'); + $query->addField('lt', 'language', 'language'); + // The i18n_strings table has two columns containing the object ID, objectid + // and objectindex. The objectid column is a text field. Therefore, for the + // join to work in PostgreSQL, use the objectindex field as this is numeric + // like the vid field. + $query->join('i18n_strings', 'i18n', 'v.vid = i18n.objectindex'); + $query->leftJoin('locales_target', 'lt', 'lt.lid = i18n.lid'); + + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + return [ + 'vid' => $this->t('The vocabulary ID.'), + 'language' => $this->t('Language for this field.'), + 'property' => $this->t('Name of property being translated.'), + 'translation' => $this->t('Translation of either the title or explanation.'), + ]; + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['vid']['type'] = 'integer'; + return $ids; + } + +}