You are here

public function FieldOptionTranslation::query in Drupal 8

Same name in this branch
  1. 8 core/modules/field/src/Plugin/migrate/source/d6/FieldOptionTranslation.php \Drupal\field\Plugin\migrate\source\d6\FieldOptionTranslation::query()
  2. 8 core/modules/field/src/Plugin/migrate/source/d7/FieldOptionTranslation.php \Drupal\field\Plugin\migrate\source\d7\FieldOptionTranslation::query()
Same name and namespace in other branches
  1. 9 core/modules/field/src/Plugin/migrate/source/d7/FieldOptionTranslation.php \Drupal\field\Plugin\migrate\source\d7\FieldOptionTranslation::query()

Return value

\Drupal\Core\Database\Query\SelectInterface

Overrides Field::query

File

core/modules/field/src/Plugin/migrate/source/d7/FieldOptionTranslation.php, line 18

Class

FieldOptionTranslation
Gets field option label translations.

Namespace

Drupal\field\Plugin\migrate\source\d7

Code

public function query() {
  $query = parent::query();
  $query
    ->leftJoin('i18n_string', 'i18n', 'i18n.type = fc.field_name');
  $query
    ->innerJoin('locales_target', 'lt', 'lt.lid = i18n.lid');
  $query
    ->condition('i18n.textgroup', 'field')
    ->condition('objectid', '#allowed_values');

  // Add all i18n and locales_target fields.
  $query
    ->fields('i18n', [
    // All table fields except lid and type.
    'textgroup',
    'context',
    'objectid',
    'property',
    'objectindex',
    'format',
  ])
    ->fields('lt');
  $query
    ->addField('fci', 'bundle');
  $query
    ->addField('i18n', 'lid', 'i18n_lid');
  $query
    ->addField('i18n', 'type', 'i18n_type');
  $query
    ->orderBy('i18n.lid');
  return $query;
}