0

I'm trying to migrate filter_format from d6 to d9, I'm using embedded_data 'cause migrate_drupal doesn't work with D6; so I'm trying to do it in another way.

This is my yml file.

id: project_filter_format
label: Filter format configuration
migration_group: project_filter_format
migration_tags:
  - Drupal 6
  - Configuration
source:
  plugin: embedded_data
  data_rows:
    -
      format: 1
      name: Filtered HTML
      cache: 1
      roles:
      filters:
        -
          module: filter
          delta: 0
          weight: -10
          settings:
            -
              fid: 55
  ids:
    -
      fid
process:
  format:
    plugin: machine_name
    source: name
  name: name
  cache: cache
  filters:
    plugin: sub_process
    source: filters
    key: '@id'
    process:
      id:
        # If the filter ID cannot be mapped, it will be passed through
        # unchanged because the bypass flag is set. The filter_id plugin
        # will flatten the input value and default it to filter_null (the
        # fallback filter plugin ID) if the flattened input value is not
        # a valid plugin ID.
        plugin: filter_id
        source:
          - module
          - delta
        bypass: true
        map:
          filter:
            - filter_html
            - filter_autop
            - filter_url
            - filter_htmlcorrector
            - filter_html_escape
      settings:
        plugin: filter_settings
        source: settings
      status:
        plugin: default_value
        default_value: true
destination:
  plugin: entity:filter_format
  no_stub: true

I have check Drupal\filter\Plugin\migrate\source\d6\FilterFormat.php to try to understand if the row it has the correct structure.

    -
      format: 1
      name: Filtered HTML
      cache: 1
      roles:
      filters:
        -
          module: filter
          delta: 0
          weight: -10
          settings:
            -
              fid: 55

But I'm not sure if it's the problem or is another.

This is the error I get.

Migration failed with source plugin exception: '0' is defined as a source ID but has no value. in /var/www/html/web/core/modules/migrate/src/Row.php line 108

I'm not sure if the problem it's de data_rows, the source IDs definition, or I'm missing something.

1 Answer 1

0

This happens because the source ID property (fid) does not exist. As the file is structured, only the following could be used as such: format, name, cache, roles, filters. By the way roles is not mapped nor used while you process the row.

You could just do the following:

source:
  plugin: embedded_data
  data_rows:
    - id: 1
      format: 1
      name: Filtered HTML
      cache: 1
      roles:
      filters:
        - module: filter
          delta: 0
          weight: -10
          settings:
            -
              fid: 55
  ids:
    id:
      type: string

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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