3 namespace Drupal\block\Plugin\migrate\source\d6;
5 use Drupal\block\Plugin\migrate\source\Block;
6 use Drupal\migrate\Plugin\migrate\source\SourcePluginBase;
7 use Drupal\migrate\Row;
10 * Gets i18n block data from source database.
13 * id = "d6_block_translation",
14 * source_module = "i18nblocks"
17 class BlockTranslation extends Block {
22 public function query() {
23 // Let the parent set the block table to use, but do not use the parent
24 // query. Instead build a query so can use an inner join to the selected
27 $query = $this->select('i18n_blocks', 'i18n')
29 ->fields('b', ['bid', 'module', 'delta', 'theme', 'title']);
30 $query->innerJoin($this->blockTable, 'b', ('b.module = i18n.module AND b.delta = i18n.delta'));
37 public function fields() {
39 'bid' => $this->t('The block numeric identifier.'),
40 'ibid' => $this->t('The i18n_blocks block numeric identifier.'),
41 'module' => $this->t('The module providing the block.'),
42 'delta' => $this->t("The block's delta."),
43 'type' => $this->t('Block type'),
44 'language' => $this->t('Language for this field.'),
45 'theme' => $this->t('Which theme the block is placed in.'),
46 'default_theme' => $this->t('The default theme.'),
47 'title' => $this->t('Block title.'),
54 public function prepareRow(Row $row) {
55 $row->setSourceProperty('default_theme', $this->defaultTheme);
56 return SourcePluginBase::prepareRow($row);
62 public function getIds() {
63 $ids = parent::getIds();
64 $ids['module']['alias'] = 'b';
65 $ids['delta']['alias'] = 'b';
66 $ids['theme']['alias'] = 'b';
67 $ids['language']['type'] = 'string';