public function FieldOptionTranslation::query in Drupal 9
Same name in this branch
- 9 core/modules/field/src/Plugin/migrate/source/d6/FieldOptionTranslation.php \Drupal\field\Plugin\migrate\source\d6\FieldOptionTranslation::query()
- 9 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
- 8 core/modules/field/src/Plugin/migrate/source/d6/FieldOptionTranslation.php \Drupal\field\Plugin\migrate\source\d6\FieldOptionTranslation::query()
Return value
\Drupal\Core\Database\Query\SelectInterface
Overrides Field::query
1 call to FieldOptionTranslation::query()
- FieldInstanceOptionTranslation::query in core/
modules/ field/ src/ Plugin/ migrate/ source/ d6/ FieldInstanceOptionTranslation.php
1 method overrides FieldOptionTranslation::query()
- FieldInstanceOptionTranslation::query in core/
modules/ field/ src/ Plugin/ migrate/ source/ d6/ FieldInstanceOptionTranslation.php
File
- core/
modules/ field/ src/ Plugin/ migrate/ source/ d6/ FieldOptionTranslation.php, line 22
Class
- FieldOptionTranslation
- Drupal 6 i18n field option labels source from database.
Namespace
Drupal\field\Plugin\migrate\source\d6Code
public function query() {
// Get the fields that have field options translations.
$query = $this
->select('i18n_strings', 'i18n')
->fields('i18n')
->fields('lt', [
'translation',
'language',
'plid',
'plural',
])
->condition('i18n.type', 'field')
->condition('property', 'option\\_%', 'LIKE');
$query
->innerJoin('locales_target', 'lt', '[lt].[lid] = [i18n].[lid]');
$query
->leftjoin('content_node_field', 'cnf', '[cnf].[field_name] = [i18n].[objectid]');
$query
->addField('cnf', 'field_name');
$query
->addField('cnf', 'global_settings');
// Minimise changes to the d6_field_option_translation.yml, which is copied
// from d6_field.yml, by ensuring the 'type' property is from
// content_node_field table.
$query
->addField('cnf', 'type');
$query
->addField('i18n', 'type', 'i18n_type');
// The i18n_string module adds a status column to locale_target. It was
// originally 'status' in a later revision it was named 'i18n_status'.
/** @var \Drupal\Core\Database\Schema $db */
if ($this
->getDatabase()
->schema()
->fieldExists('locales_target', 'status')) {
$query
->addField('lt', 'status', 'i18n_status');
}
if ($this
->getDatabase()
->schema()
->fieldExists('locales_target', 'i18n_status')) {
$query
->addField('lt', 'i18n_status');
}
return $query;
}