Migrate a textfield to keep formatted

Created on 12 May 2020, over 4 years ago
Updated 5 April 2024, 8 months ago

As drupal 8 can not even migrate its own fields i landed here. In my case i have a D7 field that is formatted(html editor) and after the migration it is a "longtext unformatted" instead of "longtext formatted".
I already have some custom code to transform it AFTER the migration but i wonder if that could be done in the
"migrate_plus.migration.upgrade_d7_node_NODE_MACHINENAME" generated my migrate plus.

I shortened the following file a bit. The fields name is "field_custom_status:"
I have to use a sub_process if if i unserstood this correctly.

uuid: 79fffbc5-c22d-4b8b-bd96-bc77f976fd41
langcode: de
status: true
dependencies: {  }
id: upgrade_d7_node_product_review
class: Drupal\migrate\Plugin\Migration
field_plugin_method: null
cck_plugin_method: null
migration_tags:
  - 'Drupal 7'
  - Content
migration_group: migrate_drupal_7
label: 'Nodes (Produkt Test)'
source:
  plugin: d7_node
  node_type: product_review
process:
  nid:
    -
      plugin: get
      source: tnid
  field_custom_status:
    -
      plugin: get
      source: field_custom_status
  field_custom_:
    - plugin: sub_process
      source: field_custom_
      process:
        type:
          plugin: default_value
          default_value: example
          title: title
          field_formatted_text/value: source_field
          field_formatted_text/format: full_html   
  field_metatag:
    -
      plugin: d7_metatag_entities
      source: pseudo_metatag_entities
destination:
  plugin: 'entity:node'
  default_bundle: product_review
migration_dependencies:
  required:
    - upgrade_d7_user
    - upgrade_d7_node_type
  optional:
    - upgrade_d7_field_instance
    - upgrade_d7_comment_field_instance
    - upgrade_d7_metatag_field
    - upgrade_d7_metatag_field_instance

πŸ’¬ Support request
Status

Closed: outdated

Version

4.2

Component

Examples

Created by

πŸ‡©πŸ‡ͺGermany marcoka

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡ͺGermany gogowitsch

    Let’s focus on the string before the colon. I would expect something like:

    ...
    process:
      field_custom_status/value: field_custom_status_value
      field_custom_status/format: field_custom_status_format
    ...
    

    However, the value behind the colon is most likely wrong, as I don’t know what keys your source produces.

  • Status changed to Closed: outdated 8 months ago
  • πŸ‡©πŸ‡ͺGermany marcoka
Production build 0.71.5 2024