LanguageContentSettingsTaxonomyVocabulary.php in Drupal 10
File
core/modules/language/src/Plugin/migrate/source/d6/LanguageContentSettingsTaxonomyVocabulary.php
View source
<?php
namespace Drupal\language\Plugin\migrate\source\d6;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
class LanguageContentSettingsTaxonomyVocabulary extends DrupalSqlBase {
public function query() {
$query = $this
->select('vocabulary', 'v')
->fields('v', [
'vid',
]);
if ($this
->getDatabase()
->schema()
->fieldExists('vocabulary', 'language')) {
$query
->addField('v', 'language');
}
return $query;
}
public function fields() {
return [
'vid' => $this
->t('The vocabulary ID.'),
'language' => $this
->t('The default language for new terms.'),
'state' => $this
->t('The i18n taxonomy translation setting.'),
];
}
public function prepareRow(Row $row) {
$i18ntaxonomy_vocabulary = $this
->variableGet('i18ntaxonomy_vocabulary', []);
$vid = $row
->getSourceProperty('vid');
$state = 0;
if (array_key_exists($vid, $i18ntaxonomy_vocabulary)) {
$state = $i18ntaxonomy_vocabulary[$vid];
}
$row
->setSourceProperty('state', $state);
return parent::prepareRow($row);
}
public function getIds() {
$ids['vid']['type'] = 'integer';
return $ids;
}
}