2

I want to migrate content from a non-Drupal CMS to Drupal 8 using the Migration API. In the source CMS, I have different types of content that I have to map to Drupal 8 content types. The navigation needs to be migrated, too. Thats a task, I already finished. During the process, I create a page type for every menu_link_content like so:

# Migration configuration
id: navigation_main
label: Main navigation
migration_group: test

source:
  plugin: url
  data_fetcher_plugin: http
  data_parser_plugin: json
  urls: 'http://my.url.com/migrate/structure?start=841'
  item_selector: data
  fields:
    -
      name: tid
      label: 'Unique element id'
      selector: tid
    -
      name: nav_title
      label: 'Element title'
      selector: nav_title
    -
      name: path
      label: 'ID Path from root down to given id'
      selector: path
    -
      name: parent_tid
      label: 'Parent id'
      selector: parent_tid
    -
      name: elementtype_unique_id
      label: 'Elementtype'
      selector: elementtype_unique_id
  ids:
    tid:
      type: integer

destination:
  plugin: entity:menu_link_content
  no_stub: true

process:
  bundle: menu_link_content
  title: nav_title

  menu_name:
    plugin: default_value
    default_value: main

  'link/uri':
    -
      plugin: migration
      migration: page_node # Use different migrations here
      source: tid
    -
      plugin: generate_path

  route_name: '@route/route_name'

  ...

That works as expected. The page_node migration uses the same url as the navigation_main migration. But thats not what I want. Now, I need to create different content types depending on the source "element_type_unique_id". Each row needs to fetch its data from the source CSM via HTTP GET first (using the "tid" as indicator), e.g. http://my.url.com/migrate/element?id=1234. The Response gives me all the data I want to migrate to Drupal 8 according to the elementype in the source CMS. I think I have to write a migration for every type but I don't know how and where to connect them in the migration process.

Is this possible? Thanks for your help!

Your Answer

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

Browse other questions tagged or ask your own question.