class Vocabulary
Same name in this branch
- 9 core/modules/taxonomy/src/Entity/Vocabulary.php \Drupal\taxonomy\Entity\Vocabulary
- 9 core/modules/taxonomy/src/Plugin/migrate/source/d7/Vocabulary.php \Drupal\taxonomy\Plugin\migrate\source\d7\Vocabulary
Same name and namespace in other branches
- 11.x core/modules/taxonomy/src/Entity/Vocabulary.php \Drupal\taxonomy\Entity\Vocabulary
- 11.x core/modules/taxonomy/src/Plugin/migrate/source/d6/Vocabulary.php \Drupal\taxonomy\Plugin\migrate\source\d6\Vocabulary
- 11.x core/modules/taxonomy/src/Plugin/migrate/source/d7/Vocabulary.php \Drupal\taxonomy\Plugin\migrate\source\d7\Vocabulary
- 10 core/modules/taxonomy/src/Entity/Vocabulary.php \Drupal\taxonomy\Entity\Vocabulary
- 10 core/modules/taxonomy/src/Plugin/migrate/source/d6/Vocabulary.php \Drupal\taxonomy\Plugin\migrate\source\d6\Vocabulary
- 10 core/modules/taxonomy/src/Plugin/migrate/source/d7/Vocabulary.php \Drupal\taxonomy\Plugin\migrate\source\d7\Vocabulary
- 8.9.x core/modules/taxonomy/src/Entity/Vocabulary.php \Drupal\taxonomy\Entity\Vocabulary
- 8.9.x core/modules/taxonomy/src/Plugin/migrate/source/d6/Vocabulary.php \Drupal\taxonomy\Plugin\migrate\source\d6\Vocabulary
- 8.9.x core/modules/taxonomy/src/Plugin/migrate/source/d7/Vocabulary.php \Drupal\taxonomy\Plugin\migrate\source\d7\Vocabulary
Drupal 6 vocabularies source from database.
For available configuration keys, refer to the parent classes.
Plugin annotation
@MigrateSource(
id = "d6_taxonomy_vocabulary",
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\Vocabulary 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 Vocabulary
See also
\Drupal\migrate\Plugin\migrate\source\SqlBase
\Drupal\migrate\Plugin\migrate\source\SourcePluginBase
39 string references to 'Vocabulary'
- DependencyTest::testUninstallDependents in core/
modules/ system/ tests/ src/ Functional/ Module/ DependencyTest.php - Tests attempting to uninstall a module that has installed dependents.
- drupal6.php in core/
modules/ migrate_drupal/ tests/ fixtures/ drupal6.php - A database agnostic dump for testing purposes.
- drupal6.php in core/
modules/ aggregator/ tests/ fixtures/ drupal6.php - A database agnostic dump for testing purposes.
- ForumBreadcrumbBuilderBase::build in core/
modules/ forum/ src/ Breadcrumb/ ForumBreadcrumbBuilderBase.php - ForumController::addContainer in core/
modules/ forum/ src/ Controller/ ForumController.php - Returns add container entity form.
File
-
core/
modules/ taxonomy/ src/ Plugin/ migrate/ source/ d6/ Vocabulary.php, line 22
Namespace
Drupal\taxonomy\Plugin\migrate\source\d6View source
class Vocabulary extends DrupalSqlBase {
/**
* {@inheritdoc}
*/
public function query() {
$query = $this->select('vocabulary', 'v')
->fields('v', [
'vid',
'name',
'description',
'help',
'relations',
'hierarchy',
'multiple',
'required',
'tags',
'module',
'weight',
]);
return $query;
}
/**
* {@inheritdoc}
*/
public function fields() {
return [
'vid' => $this->t('The vocabulary ID.'),
'name' => $this->t('The name of the vocabulary.'),
'description' => $this->t('The description of the vocabulary.'),
'help' => $this->t('Help text to display for the vocabulary.'),
'relations' => $this->t('Whether or not related terms are enabled within the vocabulary. (0 = disabled, 1 = enabled)'),
'hierarchy' => $this->t('The type of hierarchy allowed within the vocabulary. (0 = disabled, 1 = single, 2 = multiple)'),
'multiple' => $this->t('Whether or not multiple terms from this vocabulary may be assigned to a node. (0 = disabled, 1 = enabled)'),
'required' => $this->t('Whether or not terms are required for nodes using this vocabulary. (0 = disabled, 1 = enabled)'),
'tags' => $this->t('Whether or not free tagging is enabled for the vocabulary. (0 = disabled, 1 = enabled)'),
'weight' => $this->t('The weight of the vocabulary in relation to other vocabularies.'),
'parents' => $this->t("The Drupal term IDs of the term's parents."),
'node_types' => $this->t('The names of the node types the vocabulary may be used with.'),
];
}
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row) {
// Find node types for this row.
$node_types = $this->select('vocabulary_node_types', 'nt')
->fields('nt', [
'type',
'vid',
])
->condition('vid', $row->getSourceProperty('vid'))
->execute()
->fetchCol();
$row->setSourceProperty('node_types', $node_types);
$row->setSourceProperty('cardinality', $row->getSourceProperty('tags') == 1 || $row->getSourceProperty('multiple') == 1 ? FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED : 1);
// If the vocabulary being migrated is the one defined in the
// 'forum_nav_vocabulary' variable, set the 'forum_vocabulary' source
// property to true so we know this is the vocabulary used by Forum.
if ($this->variableGet('forum_nav_vocabulary', 0) == $row->getSourceProperty('vid')) {
$row->setSourceProperty('forum_vocabulary', TRUE);
}
return parent::prepareRow($row);
}
/**
* {@inheritdoc}
*/
public function getIds() {
$ids['vid']['type'] = 'integer';
return $ids;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.