Same filename in this branch
- 10 core/modules/taxonomy/src/Entity/Term.php
- 10 core/modules/taxonomy/src/Plugin/migrate/source/d6/Term.php
- 10 core/modules/taxonomy/src/Plugin/migrate/source/d7/Term.php
Same filename and directory in other branches
- 8.9.x core/modules/taxonomy/src/Plugin/migrate/source/d6/Term.php
- 9 core/modules/taxonomy/src/Plugin/migrate/source/d6/Term.php
Namespace
Drupal\taxonomy\Plugin\migrate\source\d6
File
core/modules/taxonomy/src/Plugin/migrate/source/d6/Term.php
View source
<?php
namespace Drupal\taxonomy\Plugin\migrate\source\d6;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
class Term extends DrupalSqlBase {
public function query() {
$query = $this
->select('term_data', 'td')
->fields('td')
->distinct()
->orderBy('td.tid');
if (isset($this->configuration['bundle'])) {
$query
->condition('td.vid', (array) $this->configuration['bundle'], 'IN');
}
return $query;
}
public function fields() {
$fields = [
'tid' => $this
->t('The term ID.'),
'vid' => $this
->t('Existing term VID'),
'name' => $this
->t('The name of the term.'),
'description' => $this
->t('The term description.'),
'weight' => $this
->t('Weight'),
'parent' => $this
->t("The Drupal term IDs of the term's parents."),
];
if (isset($this->configuration['translations'])) {
$fields['language'] = $this
->t('The term language.');
$fields['trid'] = $this
->t('Translation ID.');
}
return $fields;
}
public function prepareRow(Row $row) {
$parents = $this
->select('term_hierarchy', 'th')
->fields('th', [
'parent',
'tid',
])
->condition('tid', $row
->getSourceProperty('tid'))
->execute()
->fetchCol();
$row
->setSourceProperty('parent', $parents);
return parent::prepareRow($row);
}
public function getIds() {
$ids['tid']['type'] = 'integer';
return $ids;
}
}
Classes
Name |
Description |
Term |
Drupal 6 taxonomy term source from database. |