leftJoin(static::I18N_STRING_TABLE, 'i18n', 'CAST(ml.mlid as CHAR(255)) = i18n.objectid'); $query->isNotNull('i18n.lid'); $query->addField('i18n', 'lid'); $query->addField('i18n', 'property'); // Add in the translation for the property. $query->innerJoin('locales_target', 'lt', 'i18n.lid = lt.lid'); $query->addField('lt', 'language'); $query->addField('lt', 'translation'); return $query; } /** * {@inheritdoc} */ public function prepareRow(Row $row) { parent::prepareRow($row); // Save the translation for this property. $property_in_row = $row->getSourceProperty('property'); // Set the i18n string table for use in I18nQueryTrait. $this->i18nStringTable = static::I18N_STRING_TABLE; // Get the translation for the property not already in the row and save it // in the row. $property_not_in_row = ($property_in_row == 'title') ? 'description' : 'title'; return $this->getPropertyNotInRowTranslation($row, $property_not_in_row, 'mlid', $this->idMap); } /** * {@inheritdoc} */ public function fields() { $fields = [ 'language' => $this->t('Language for this menu.'), 'title_translated' => $this->t('Menu link title translation.'), 'description_translated' => $this->t('Menu link description translation.'), ]; return parent::fields() + $fields; } /** * {@inheritdoc} */ public function getIds() { $ids['language']['type'] = 'string'; return parent::getIds() + $ids; } }