class TermNode in Zircon Profile 8
Same name in this branch
- 8 core/modules/taxonomy/src/Plugin/migrate/source/d6/TermNode.php \Drupal\taxonomy\Plugin\migrate\source\d6\TermNode
- 8 core/modules/taxonomy/src/Plugin/migrate/builder/d6/TermNode.php \Drupal\taxonomy\Plugin\migrate\builder\d6\TermNode
Same name and namespace in other branches
- 8.0 core/modules/taxonomy/src/Plugin/migrate/builder/d6/TermNode.php \Drupal\taxonomy\Plugin\migrate\builder\d6\TermNode
Plugin annotation
@PluginID("d6_term_node");
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, StringTranslationTrait
- class \Drupal\migrate\Plugin\migrate\builder\BuilderBase implements MigrateBuilderInterface
- class \Drupal\taxonomy\Plugin\migrate\builder\d6\TermNode implements ContainerFactoryPluginInterface
- class \Drupal\migrate\Plugin\migrate\builder\BuilderBase implements MigrateBuilderInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, StringTranslationTrait
Expanded class hierarchy of TermNode
File
- core/
modules/ taxonomy/ src/ Plugin/ migrate/ builder/ d6/ TermNode.php, line 21 - Contains \Drupal\taxonomy\Plugin\migrate\builder\d6\TermNode.
Namespace
Drupal\taxonomy\Plugin\migrate\builder\d6View source
class TermNode extends BuilderBase implements ContainerFactoryPluginInterface {
/**
* The migration template storage service.
*
* @var \Drupal\migrate\MigrateTemplateStorage
*/
protected $templateStorage;
/**
* Constructs a TermNode builder.
*
* @param array $configuration
* Plugin configuration.
* @param string $plugin_id
* The plugin ID.
* @param mixed $plugin_definition
* The plugin definition.
* @param \Drupal\migrate\MigrateTemplateStorage $template_storage
* The migration template storage handler.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrateTemplateStorage $template_storage) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->templateStorage = $template_storage;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('migrate.template_storage'));
}
/**
* Builds a map of source vocabulary IDs to expected destination IDs.
*
* @param array $source
* Additional configuration for the d6_taxonomy_vocabulary source.
*
* @return array
* The vid map. The keys are the source IDs and the values are the
* (expected) destination IDs.
*/
protected function getVocabularyIdMap(array $source) {
$map = [];
$template = $this->templateStorage
->getTemplateByName('d6_taxonomy_vocabulary');
$template['source'] += $source;
$migration = Migration::create($template);
$executable = new MigrateExecutable($migration, new MigrateMessage());
// Only process the destination ID properties.
$process = array_intersect_key($template['process'], $migration
->getDestinationPlugin()
->getIds());
foreach ($migration
->getSourcePlugin() as $source_row) {
// Process the row to generate the expected destination ID.
$executable
->processRow($source_row, $process);
$map[$source_row
->getSourceProperty('vid')] = $source_row
->getDestinationProperty('vid');
}
return $map;
}
/**
* {@inheritdoc}
*/
public function buildMigrations(array $template) {
$migrations = [];
foreach ($this
->getVocabularyIdMap($template['source']) as $source_vid => $destination_vid) {
$values = $template;
$values['id'] .= '__' . $source_vid;
$values['source']['vid'] = $source_vid;
$migration = Migration::create($values);
$migration
->setProcessOfProperty($destination_vid, 'tid');
$migrations[] = $migration;
}
return $migrations;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BuilderBase:: |
protected | function | Returns a fully initialized instance of a source plugin. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 2 |
PluginBase:: |
protected | property | The plugin implementation definition. | |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
TermNode:: |
protected | property | The migration template storage service. | |
TermNode:: |
public | function |
Builds migration entities based on a template. Overrides MigrateBuilderInterface:: |
|
TermNode:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
TermNode:: |
protected | function | Builds a map of source vocabulary IDs to expected destination IDs. | |
TermNode:: |
public | function |
Constructs a TermNode builder. Overrides PluginBase:: |