function FieldLabelDescriptionTranslation::query

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

Overrides SqlBase::query

File

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

Class

FieldLabelDescriptionTranslation
Drupal 7 i18n field label and description source from database.

Namespace

Drupal\field\Plugin\migrate\source\d7

Code

public function query() {
    // Get translations for field labels and descriptions.
    $query = $this->select('i18n_string', 'i18n')
        ->fields('i18n')
        ->fields('lt', [
        'lid',
        'translation',
        'language',
        'plid',
        'plural',
        'i18n_status',
    ])
        ->fields('fci', [
        'id',
        'field_id',
        'field_name',
        'entity_type',
        'bundle',
        'data',
        'deleted',
    ])
        ->condition('i18n.textgroup', 'field');
    $condition = $query->orConditionGroup()
        ->condition('textgroup', 'field')
        ->condition('objectid', '#allowed_values', '!=');
    $query->condition($condition);
    $query->innerJoin('locales_target', 'lt', '[lt].[lid] = [i18n].[lid]');
    $query->leftjoin('field_config_instance', 'fci', '[fci].[bundle] = [i18n].[objectid] AND [fci].[field_name] = [i18n].[type]');
    return $query;
}

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