Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / config_translation / src / Plugin / migrate / source / d6 / ProfileFieldTranslation.php
1 <?php
2
3 namespace Drupal\config_translation\Plugin\migrate\source\d6;
4
5 use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
6
7 /**
8  * Gets i18n strings profile field source from database.
9  *
10  * @MigrateSource(
11  *   id = "d6_profile_field_translation",
12  *   source_module = "i18nprofile"
13  * )
14  */
15 class ProfileFieldTranslation extends DrupalSqlBase {
16
17   /**
18    * {@inheritdoc}
19    */
20   public function query() {
21     $query = $this->select('profile_fields', 'pf')
22       ->fields('pf', ['fid', 'name'])
23       ->fields('i18n', ['property'])
24       ->fields('lt', ['lid', 'translation', 'language']);
25     $query->leftJoin('i18n_strings', 'i18n', 'i18n.objectid = pf.name');
26     $query->leftJoin('locales_target', 'lt', 'lt.lid = i18n.lid');
27     return $query;
28   }
29
30   /**
31    * {@inheritdoc}
32    */
33   public function fields() {
34     return [
35       'fid' => $this->t('Profile field ID.'),
36       'lid' => $this->t('Locales target language ID.'),
37       'language' => $this->t('Language for this field.'),
38       'translation' => $this->t('Translation of either the title or explanation.'),
39     ];
40   }
41
42   /**
43    * {@inheritdoc}
44    */
45   public function getIds() {
46     $ids['fid']['type'] = 'integer';
47     $ids['language']['type'] = 'string';
48     $ids['lid']['type'] = 'integer';
49     $ids['lid']['alias'] = 'lt';
50     return $ids;
51   }
52
53 }