class D6TermNodeDeriver

Same name in other branches
  1. 9 core/modules/taxonomy/src/Plugin/migrate/D6TermNodeDeriver.php \Drupal\taxonomy\Plugin\migrate\D6TermNodeDeriver
  2. 8.9.x core/modules/taxonomy/src/Plugin/migrate/D6TermNodeDeriver.php \Drupal\taxonomy\Plugin\migrate\D6TermNodeDeriver
  3. 11.x core/modules/taxonomy/src/Plugin/migrate/D6TermNodeDeriver.php \Drupal\taxonomy\Plugin\migrate\D6TermNodeDeriver

Deriver for Drupal 6 term node migrations based on vocabularies.

Hierarchy

Expanded class hierarchy of D6TermNodeDeriver

3 string references to 'D6TermNodeDeriver'
d6_term_node.yml in core/modules/taxonomy/migrations/d6_term_node.yml
core/modules/taxonomy/migrations/d6_term_node.yml
d6_term_node_revision.yml in core/modules/taxonomy/migrations/d6_term_node_revision.yml
core/modules/taxonomy/migrations/d6_term_node_revision.yml
d6_term_node_translation.yml in core/modules/content_translation/migrations/d6_term_node_translation.yml
core/modules/content_translation/migrations/d6_term_node_translation.yml

File

core/modules/taxonomy/src/Plugin/migrate/D6TermNodeDeriver.php, line 14

Namespace

Drupal\taxonomy\Plugin\migrate
View source
class D6TermNodeDeriver extends DeriverBase implements ContainerDeriverInterface {
    use MigrationDeriverTrait;
    
    /**
     * The base plugin ID this derivative is for.
     *
     * @var string
     */
    protected $basePluginId;
    
    /**
     * The migration plugin manager.
     *
     * @var \Drupal\Component\Plugin\PluginManagerInterface
     */
    protected $migrationPluginManager;
    
    /**
     * D6TermNodeDeriver constructor.
     *
     * @param string $base_plugin_id
     *   The base plugin ID this derivative is for.
     * @param \Drupal\Component\Plugin\PluginManagerInterface $migration_plugin_manager
     *   The migration plugin manager.
     */
    public function __construct($base_plugin_id, PluginManagerInterface $migration_plugin_manager) {
        $this->basePluginId = $base_plugin_id;
        $this->migrationPluginManager = $migration_plugin_manager;
    }
    
    /**
     * {@inheritdoc}
     */
    public static function create(ContainerInterface $container, $base_plugin_id) {
        return new static($base_plugin_id, $container->get('plugin.manager.migration'));
    }
    
    /**
     * {@inheritdoc}
     */
    public function getDerivativeDefinitions($base_plugin_definition, $base_plugin_definitions = NULL) {
        try {
            foreach (static::getSourcePlugin('d6_taxonomy_vocabulary') as $row) {
                $source_vid = $row->getSourceProperty('vid');
                $definition = $base_plugin_definition;
                $definition['source']['vid'] = $source_vid;
                // migrate_drupal_migration_plugins_alter() adds to this definition.
                $this->derivatives[$source_vid] = $definition;
            }
        } catch (\Exception $e) {
            // It is possible no D6 tables are loaded so just eat exceptions.
        }
        return $this->derivatives;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
D6TermNodeDeriver::$basePluginId protected property The base plugin ID this derivative is for.
D6TermNodeDeriver::$migrationPluginManager protected property The migration plugin manager.
D6TermNodeDeriver::create public static function Creates a new class instance. Overrides ContainerDeriverInterface::create
D6TermNodeDeriver::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverBase::getDerivativeDefinitions
D6TermNodeDeriver::__construct public function D6TermNodeDeriver constructor.
DeriverBase::$derivatives protected property List of derivative definitions. 1
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition
MigrationDeriverTrait::getSourcePlugin public static function Returns a fully initialized instance of a source plugin.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.