2

My goal is to take an existing D6 content type ('mini') and migrate it into one of two specific D8 content types based on its current D6 URL Alias (either 'course' or 'page') and where this alias falls in the hierarchy.

I've have successfully written a simple source plugin that adds the alias into RowSource.

How do I control the destination plugin so I can migrate into the appropriate bundle - either 'page' or 'course'? Is there any property of $row that can be adjusted to do so?

Or is this process more involved?

I know that nodes use the 'entity:node' destination plug-in, but how can I extend this per above? It's unclear to me what exact class the destination plug 'entity:node' represents

Any insight would be much appreciated.

Thanks!

2

In your config, use a row instead of the default value plugin.

Instead of this:

process:
  type:
    plugin: default_value
    default_value: course
  title: title
  etc.

use this:

process:
  type: target_bundle
  title: title
  etc.

Then you can set the target_bundle dynamically in your source class's prepareRow function.

$row->setSourceProperty('target_bundle', $target_bundle);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.