ProfileFieldOptionTranslation.php

Same filename in this branch
  1. 8.9.x core/modules/user/src/Plugin/migrate/process/d6/ProfileFieldOptionTranslation.php
Same filename in other branches
  1. 9 core/modules/user/src/Plugin/migrate/source/d6/ProfileFieldOptionTranslation.php
  2. 9 core/modules/user/src/Plugin/migrate/process/d6/ProfileFieldOptionTranslation.php
  3. 10 core/modules/user/src/Plugin/migrate/source/d6/ProfileFieldOptionTranslation.php
  4. 10 core/modules/user/src/Plugin/migrate/process/d6/ProfileFieldOptionTranslation.php
  5. 11.x core/modules/user/src/Plugin/migrate/source/d6/ProfileFieldOptionTranslation.php
  6. 11.x core/modules/user/src/Plugin/migrate/process/d6/ProfileFieldOptionTranslation.php

Namespace

Drupal\user\Plugin\migrate\source\d6

File

core/modules/user/src/Plugin/migrate/source/d6/ProfileFieldOptionTranslation.php

View source
<?php

namespace Drupal\user\Plugin\migrate\source\d6;

use Drupal\user\Plugin\migrate\source\ProfileField;

/**
 * Gets field option label translations.
 *
 * @MigrateSource(
 *   id = "d6_profile_field_option_translation",
 *   source_module = "i18nprofile"
 * )
 */
class ProfileFieldOptionTranslation extends ProfileField {
    
    /**
     * {@inheritdoc}
     */
    public function query() {
        $query = parent::query();
        $query->fields('i18n', [
            'property',
            'objectid',
        ])
            ->fields('lt', [
            'translation',
            'language',
        ])
            ->condition('i18n.type', 'field')
            ->condition('property', 'options');
        $query->leftjoin('i18n_strings', 'i18n', 'pf.name = i18n.objectid');
        $query->innerJoin('locales_target', 'lt', 'lt.lid = i18n.lid');
        return $query;
    }
    
    /**
     * {@inheritdoc}
     */
    public function fields() {
        return parent::fields() + [
            'property' => $this->t('Option ID.'),
            'objectid' => $this->t('Field name'),
            'language' => $this->t('Language for this field.'),
            'translation' => $this->t('Translation of either the title or explanation.'),
        ];
    }
    
    /**
     * {@inheritdoc}
     */
    public function getIds() {
        return parent::getIds() + [
            'language' => [
                'type' => 'string',
            ],
            'property' => [
                'type' => 'string',
            ],
        ];
    }

}

Classes

Title Deprecated Summary
ProfileFieldOptionTranslation Gets field option label translations.

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