X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ffield%2Fsrc%2FPlugin%2Fmigrate%2Fsource%2Fd6%2FFieldOptionTranslation.php;fp=web%2Fcore%2Fmodules%2Ffield%2Fsrc%2FPlugin%2Fmigrate%2Fsource%2Fd6%2FFieldOptionTranslation.php;h=bc2671a9c4a5dab8b97609ad5ea4577836795c23;hp=0000000000000000000000000000000000000000;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/field/src/Plugin/migrate/source/d6/FieldOptionTranslation.php b/web/core/modules/field/src/Plugin/migrate/source/d6/FieldOptionTranslation.php new file mode 100644 index 000000000..bc2671a9c --- /dev/null +++ b/web/core/modules/field/src/Plugin/migrate/source/d6/FieldOptionTranslation.php @@ -0,0 +1,78 @@ +select('i18n_strings', 'i18n') + ->fields('i18n') + ->fields('lt', [ + 'translation', + 'language', + 'plid', + 'plural', + 'i18n_status', + ]) + ->condition('i18n.type', 'field') + ->condition('property', 'option\_%', 'LIKE') + ->isNotNull('translation'); + $query->leftJoin('locales_target', 'lt', 'lt.lid = i18n.lid'); + $query->leftjoin('content_node_field', 'cnf', 'cnf.field_name = i18n.objectid'); + $query->addField('cnf', 'field_name'); + $query->addField('cnf', 'global_settings'); + // Minimise changes to the d6_field_option_translation.yml, which is copied + // from d6_field.yml, by ensuring the 'type' property is from + // content_node_field table. + $query->addField('cnf', 'type'); + $query->addField('i18n', 'type', 'i18n_type'); + + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + $fields = [ + 'property' => $this->t('Option ID.'), + 'objectid' => $this->t('Object ID'), + 'objectindex' => $this->t('Integer value of Object ID'), + 'format' => $this->t('The input format used by this string'), + 'lid' => $this->t('Source string ID'), + 'language' => $this->t('Language code'), + 'translation' => $this->t('Translation of the option'), + 'plid' => $this->t('Parent lid'), + 'plural' => $this->t('Plural index number in case of plural strings'), + ]; + return parent::fields() + $fields; + } + + /** + * {@inheritdoc} + */ + + /** + * {@inheritdoc} + */ + public function getIds() { + return parent::getIds() + + [ + 'language' => ['type' => 'string'], + 'property' => ['type' => 'string'], + ]; + } + +}