Migrating D7 body and summary fields to D8

Created on 5 November 2018, about 6 years ago
Updated 9 September 2022, over 2 years ago

What is the correct way to migrate Drupal 7 body fields (or other Drupal 7 long text with summary fields) to Drupal 8?

For a regular D7 content type being migrated to a D8 content type, for the body, I have tried:

body: body

and

'body/value':'body/value'
'body/summary':'body/summary'

and

body:
  plugin: sub_process
  source: body
  process:
    value: value
    summary: summary

None of these seem to work.

I also need to migrate body format, but wanted to get summary working first, so it is not in my examples above.

Thanks for you help!

πŸ’¬ Support request
Status

Closed: works as designed

Version

9.4

Component

migration system

Created by

πŸ‡ΊπŸ‡ΈUnited States captaindav

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.

  • πŸ‡³πŸ‡ΏNew Zealand davidwhthomas

    I specified the text_format during migration of the body field with this migration template yaml:

    body:
      -
        plugin: sub_process
        source: body
        process:
          value: value
          format:
            plugin: default_value
            default_value: newsletter_html
  • πŸ‡ΊπŸ‡¦Ukraine Kostiantyn

    @davidwhthomas Thank you for the comment, this is exactly what I was looking for. I tried to migrate this way, and it worked for me for a while, but I found an issue where migrations fail when all fields are empty. For some reason, skip_on_empty doesn't work as I expect it to.

    body/value:
      -
        plugin: skip_on_empty
        method: row
        source: body
      -
        plugin: extract
        source: body
        index:
          - 0
          - value
    body/summary:
      -
        plugin: skip_on_empty
        method: row
        source: body
      -
        plugin: extract
        source: body
        index:
          - 0
          - summary
    body/format:
      -
        plugin: default_value
        default_value: full_html
    
Production build 0.71.5 2024