class Term
Same name in this branch
- 9 core/modules/taxonomy/src/Entity/Term.php \Drupal\taxonomy\Entity\Term
- 9 core/modules/taxonomy/src/Plugin/views/argument_validator/Term.php \Drupal\taxonomy\Plugin\views\argument_validator\Term
- 9 core/modules/taxonomy/src/Plugin/migrate/source/d7/Term.php \Drupal\taxonomy\Plugin\migrate\source\d7\Term
Same name and namespace in other branches
- 11.x core/modules/taxonomy/src/Entity/Term.php \Drupal\taxonomy\Entity\Term
- 11.x core/modules/taxonomy/src/Plugin/migrate/source/d6/Term.php \Drupal\taxonomy\Plugin\migrate\source\d6\Term
- 11.x core/modules/taxonomy/src/Plugin/migrate/source/d7/Term.php \Drupal\taxonomy\Plugin\migrate\source\d7\Term
- 10 core/modules/taxonomy/src/Entity/Term.php \Drupal\taxonomy\Entity\Term
- 10 core/modules/taxonomy/src/Plugin/migrate/source/d6/Term.php \Drupal\taxonomy\Plugin\migrate\source\d6\Term
- 10 core/modules/taxonomy/src/Plugin/migrate/source/d7/Term.php \Drupal\taxonomy\Plugin\migrate\source\d7\Term
- 8.9.x core/modules/taxonomy/src/Entity/Term.php \Drupal\taxonomy\Entity\Term
- 8.9.x core/modules/taxonomy/src/Plugin/views/argument_validator/Term.php \Drupal\taxonomy\Plugin\views\argument_validator\Term
- 8.9.x core/modules/taxonomy/src/Plugin/migrate/source/d6/Term.php \Drupal\taxonomy\Plugin\migrate\source\d6\Term
- 8.9.x core/modules/taxonomy/src/Plugin/migrate/source/Term.php \Drupal\taxonomy\Plugin\migrate\source\Term
- 8.9.x core/modules/taxonomy/src/Plugin/migrate/source/d7/Term.php \Drupal\taxonomy\Plugin\migrate\source\d7\Term
Drupal 6 taxonomy term source from database.
Available configuration keys:
- bundle: (optional) The taxonomy vocabulary (vid) to filter terms retrieved from the source - can be an integer or an array. If omitted, all terms are retrieved.
Examples:
source:
plugin: d6_taxonomy_term
bundle: 0
In this example terms of vocabulary with 'vid' equal to 0 are retrieved from the source database.
source:
plugin: d6_taxonomy_term
bundle: [1, 3, 5]
In this example terms of vocabularies with 'vid' one of 1, 3, 5 are retrieved from the source database.
For additional configuration keys, refer to the parent classes.
@todo Support term_relation, term_synonym table if possible.
Plugin annotation
@MigrateSource(
id = "d6_taxonomy_term",
source_module = "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\taxonomy\Plugin\migrate\source\d6\Term 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 Term
See also
\Drupal\migrate\Plugin\migrate\source\SqlBase
\Drupal\migrate\Plugin\migrate\source\SourcePluginBase
14 string references to 'Term'
- CommentTokenReplaceTest::testCommentTokenReplacement in core/
modules/ comment/ tests/ src/ Functional/ CommentTokenReplaceTest.php - Creates a comment, then tests the tokens generated from it.
- comment_token_info in core/
modules/ comment/ comment.tokens.inc - Implements hook_token_info().
- CreateTestContentEntitiesTrait::createContent in core/
modules/ migrate_drupal/ tests/ src/ Traits/ CreateTestContentEntitiesTrait.php - Create several pieces of generic content.
- CreateTestContentEntitiesTrait::createContentPostUpgrade in core/
modules/ migrate_drupal/ tests/ src/ Traits/ CreateTestContentEntitiesTrait.php - Create several pieces of generic content.
- forum_views_data in core/
modules/ forum/ forum.views.inc - Implements hook_views_data().
File
-
core/
modules/ taxonomy/ src/ Plugin/ migrate/ source/ d6/ Term.php, line 48
Namespace
Drupal\taxonomy\Plugin\migrate\source\d6View source
class Term extends DrupalSqlBase {
/**
* {@inheritdoc}
*/
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;
}
/**
* {@inheritdoc}
*/
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;
}
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row) {
// Find parents for this 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);
}
/**
* {@inheritdoc}
*/
public function getIds() {
$ids['tid']['type'] = 'integer';
return $ids;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.