function FieldOptionTranslation::query

Same name in this branch
  1. 11.x core/modules/field/src/Plugin/migrate/source/d6/FieldOptionTranslation.php \Drupal\field\Plugin\migrate\source\d6\FieldOptionTranslation::query()
Same name in other branches
  1. 9 core/modules/field/src/Plugin/migrate/source/d6/FieldOptionTranslation.php \Drupal\field\Plugin\migrate\source\d6\FieldOptionTranslation::query()
  2. 9 core/modules/field/src/Plugin/migrate/source/d7/FieldOptionTranslation.php \Drupal\field\Plugin\migrate\source\d7\FieldOptionTranslation::query()
  3. 8.9.x core/modules/field/src/Plugin/migrate/source/d6/FieldOptionTranslation.php \Drupal\field\Plugin\migrate\source\d6\FieldOptionTranslation::query()
  4. 8.9.x core/modules/field/src/Plugin/migrate/source/d7/FieldOptionTranslation.php \Drupal\field\Plugin\migrate\source\d7\FieldOptionTranslation::query()
  5. 10 core/modules/field/src/Plugin/migrate/source/d6/FieldOptionTranslation.php \Drupal\field\Plugin\migrate\source\d6\FieldOptionTranslation::query()
  6. 10 core/modules/field/src/Plugin/migrate/source/d7/FieldOptionTranslation.php \Drupal\field\Plugin\migrate\source\d7\FieldOptionTranslation::query()

Overrides Field::query

File

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

Class

FieldOptionTranslation
Drupal 7 i18n field option label source from database.

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;
}

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