public function BlockTranslation::query in Drupal 9
Same name in this branch
- 9 core/modules/block/src/Plugin/migrate/source/d6/BlockTranslation.php \Drupal\block\Plugin\migrate\source\d6\BlockTranslation::query()
- 9 core/modules/block/src/Plugin/migrate/source/d7/BlockTranslation.php \Drupal\block\Plugin\migrate\source\d7\BlockTranslation::query()
Same name and namespace in other branches
- 8 core/modules/block/src/Plugin/migrate/source/d7/BlockTranslation.php \Drupal\block\Plugin\migrate\source\d7\BlockTranslation::query()
Return value
\Drupal\Core\Database\Query\SelectInterface
Overrides Block::query
File
- core/
modules/ block/ src/ Plugin/ migrate/ source/ d7/ BlockTranslation.php, line 24
Class
- BlockTranslation
- Gets i18n block data from source database.
Namespace
Drupal\block\Plugin\migrate\source\d7Code
public function query() {
// Let the parent set the block table to use, but do not use the parent
// query. Instead build a query so can use an inner join to the selected
// block table.
parent::query();
$query = $this
->select('i18n_string', 'i18n')
->fields('i18n')
->fields('b', [
'bid',
'module',
'delta',
'theme',
'status',
'weight',
'region',
'custom',
'visibility',
'pages',
'title',
'cache',
'i18n_mode',
])
->fields('lt', [
'lid',
'translation',
'language',
'plid',
'plural',
])
->condition('i18n_mode', 1);
$query
->leftjoin($this->blockTable, 'b', '[b].[delta] = [i18n].[objectid]');
$query
->innerJoin('locales_target', 'lt', '[lt].[lid] = [i18n].[lid]');
// 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', 'i18n_status');
}
return $query;
}