ProfileFieldOptionTranslation.php

Same filename in this branch
  1. 10 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. 8.9.x core/modules/user/src/Plugin/migrate/source/d6/ProfileFieldOptionTranslation.php
  4. 8.9.x 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;
// cspell:ignore nprofile objectid

/**
 * Drupal 6 i18n profile field option labels source from database.
 *
 * For available configuration keys, refer to the parent classes.
 *
 * @see \Drupal\migrate\Plugin\migrate\source\SqlBase
 * @see \Drupal\migrate\Plugin\migrate\source\SourcePluginBase
 *
 * @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 Drupal 6 i18n profile field option labels source from database.

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