ProfileFieldTranslation.php in Drupal 10
File
core/modules/config_translation/src/Plugin/migrate/source/d6/ProfileFieldTranslation.php
View source
<?php
namespace Drupal\config_translation\Plugin\migrate\source\d6;
use Drupal\user\Plugin\migrate\source\ProfileField;
class ProfileFieldTranslation extends ProfileField {
public function query() {
$query = parent::query();
$query
->fields('i18n', [
'property',
])
->fields('lt', [
'lid',
'translation',
'language',
]);
$query
->leftJoin('i18n_strings', 'i18n', '[i18n].[objectid] = [pf].[name]');
$query
->innerJoin('locales_target', 'lt', '[lt].[lid] = [i18n].[lid]');
return $query;
}
public function fields() {
$fields = [
'lid' => $this
->t('Locales target language ID.'),
'language' => $this
->t('Language for this field.'),
'translation' => $this
->t('Translation of either the title or explanation.'),
];
return parent::fields() + $fields;
}
public function getIds() {
$ids['language']['type'] = 'string';
$ids['lid']['type'] = 'integer';
$ids['lid']['alias'] = 'lt';
return parent::getIds() + $ids;
}
}