class TermTranslation
Same name and namespace in other branches
- 11.x core/modules/taxonomy/src/Plugin/migrate/source/d7/TermTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d7\TermTranslation
- 10 core/modules/taxonomy/src/Plugin/migrate/source/d7/TermTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d7\TermTranslation
- 8.9.x core/modules/taxonomy/src/Plugin/migrate/source/d7/TermTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d7\TermTranslation
Drupal 7 i18n taxonomy terms source from database.
For available configuration keys, refer to the parent classes.
Plugin annotation
@MigrateSource(
id = "d7_taxonomy_term_translation",
source_module = "i18n_taxonomy"
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait extends \Drupal\Component\Plugin\PluginBase
- class \Drupal\migrate\Plugin\migrate\source\SourcePluginBase implements \Drupal\migrate\Plugin\MigrateSourceInterface, \Drupal\migrate\Event\RollbackAwareInterface extends \Drupal\Core\Plugin\PluginBase
- class \Drupal\migrate\Plugin\migrate\source\SqlBase implements \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\migrate\Plugin\RequirementsInterface extends \Drupal\migrate\Plugin\migrate\source\SourcePluginBase
- class \Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase implements \Drupal\Component\Plugin\DependentPluginInterface uses \Drupal\Core\Entity\DependencyTrait extends \Drupal\migrate\Plugin\migrate\source\SqlBase
- class \Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity extends \Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase
- class \Drupal\taxonomy\Plugin\migrate\source\d7\Term extends \Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity
- class \Drupal\taxonomy\Plugin\migrate\source\d7\TermTranslation extends \Drupal\taxonomy\Plugin\migrate\source\d7\Term
- class \Drupal\taxonomy\Plugin\migrate\source\d7\Term extends \Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity
- class \Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity extends \Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase
- class \Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase implements \Drupal\Component\Plugin\DependentPluginInterface uses \Drupal\Core\Entity\DependencyTrait extends \Drupal\migrate\Plugin\migrate\source\SqlBase
- class \Drupal\migrate\Plugin\migrate\source\SqlBase implements \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\migrate\Plugin\RequirementsInterface extends \Drupal\migrate\Plugin\migrate\source\SourcePluginBase
- class \Drupal\migrate\Plugin\migrate\source\SourcePluginBase implements \Drupal\migrate\Plugin\MigrateSourceInterface, \Drupal\migrate\Event\RollbackAwareInterface extends \Drupal\Core\Plugin\PluginBase
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait extends \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of TermTranslation
See also
\Drupal\taxonomy\Plugin\migrate\source\d7\Term
\Drupal\migrate\Plugin\migrate\source\SqlBase
\Drupal\migrate\Plugin\migrate\source\SourcePluginBase
File
-
core/
modules/ taxonomy/ src/ Plugin/ migrate/ source/ d7/ TermTranslation.php, line 21
Namespace
Drupal\taxonomy\Plugin\migrate\source\d7View source
class TermTranslation extends Term {
/**
* {@inheritdoc}
*/
public function query() {
$query = parent::query();
if ($this->database
->schema()
->fieldExists('taxonomy_term_data', 'language')) {
$query->addField('td', 'language', 'td_language');
}
// Get data when the i18n_mode column exists and it is not the Drupal 7
// value I18N_MODE_NONE or I18N_MODE_LOCALIZE. Otherwise, return no data.
// @see https://git.drupalcode.org/project/i18n/-/blob/7.x-1.x/i18n.module#L26
if ($this->database
->schema()
->fieldExists('taxonomy_vocabulary', 'i18n_mode')) {
$query->addField('tv', 'i18n_mode');
$query->condition('tv.i18n_mode', [
'0',
'1',
], 'NOT IN');
}
else {
$query->alwaysFalse();
}
return $query;
}
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row) {
if (!parent::prepareRow($row)) {
return FALSE;
}
$row->setSourceProperty('language', $row->getSourceProperty('td_language'));
}
/**
* {@inheritdoc}
*/
public function fields() {
$fields = [
'language' => $this->t('Language for this term.'),
'name_translated' => $this->t('Term name translation.'),
'description_translated' => $this->t('Term description translation.'),
];
return parent::fields() + $fields;
}
/**
* {@inheritdoc}
*/
public function getIds() {
$ids['language']['type'] = 'string';
$ids['language']['alias'] = 'td';
return parent::getIds() + $ids;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.