Skip to main content
drupalreleases
Release: Better Exposed Filters 7.2.0 — Minor update available for module better_exposed_filters (7.2.0). Release: Bootstrap 8.x-3.43 — Minor update available for theme bootstrap (8.x-3.43). Release: Svg Image 3.2.5 — Minor update available for module svg_image (3.2.5). Release: Book 3.0.8 — Minor update available for module book (3.0.8). Release: Tagify 2.0.5 — Minor update available for module tagify (2.0.5). Release: Editoria11y Accessibility Checker 3.0.11 — Minor update available for module editoria11y (3.0.11). Release: Events Log Track 5.0.1 — Minor update available for module events_log_track (5.0.1). Release: Workflow 2.1.14 — Minor update available for module workflow (2.1.14). Module Revived: @font-your-face 4.3.0 — Module fontyourface updated after 7 months of inactivity (4.3.0). Security Coverage: Open Y Branch Selector — Module openy_branch_selector now has official Drupal security advisory coverage.

Migrate Child Entity Generate

91 sites Security covered Drupal 11 · not 10
View on drupal.org

This plugin helps generate child entities, such as paragraphs, which are contextually linked to a parent entity. It allows you to create these child entities using an array of values directly, making it ideal for situations where these child entities don't need a separate check for existing instances.

This process plugin generates entities that only exist in context of their parent, eg. paragraphs.

The more commonly used entity_generate plugin by the Migrate Plus module does not support generating an entity by passing an array of values, and getting the entity fields from that array. This is mostly useful for generating entities that don't need to be checked for previous existence because they only exist in context of their parent, eg. paragraphs.

Example usage

destination:
  plugin: 'entity:node'
source:
  # assuming we're using a source plugin that lets us define fields like this
  fields:
    -
      faq_items:
        -
          question: Some question
          answer: Some answer
        -
          question: Another question
          answer: Another answer
process:
  field_faqs:
    plugin: child_entity_generate
    source: faq_items
    entity_type: field_collection
    bundle: faq
    values:
      field_faq_question: question
      field_faq_answer/value: answer
    default_values:
      field_faq_answer/format: basic_html

If you want to store the whole value in a destination property instead of providing a mapping,
you can define the destination property name in the 'destination' key:

destination:
  plugin: 'entity:node'
source:
  # assuming we're using a source plugin that lets us define fields like this
  fields:
    -
      questions:
        - Some question
        - Another question
process:
  field_faqs:
    plugin: child_entity_generate
    source: questions
    entity_type: field_collection
    bundle: question
    destination: field_question

If processing needs to happen on the values, you can pass them through the sub_process plugin first:

destination:
  plugin: 'entity:node'
source:
  # assuming we're using a source plugin that lets us define fields like this
  fields:
    -
      faq_items:
        -
          id: 100
          isHighlighted: true
        -
          id: 101
          isHighlighted: false
process:
  field_faqs:
   -
     plugin: sub_process
     source: faq_items
     process:
       entity:
         plugin: migration_lookup
         migration: faqs
         source: id
       isHighlighted: isHighlighted
   -
     plugin: child_entity_generate
     entity_type: field_collection
     bundle: faq
     values:
       field_faq_entity: entity
       field_faq_is_highlighted: isHighlighted

Depends on

Dependencies of the latest stable release

  • migrate Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
5
Tracked since
May 2024
Latest release
2 weeks ago
Releases (12 mo)
2 ▲ from 1
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
1.1.0 Stable 11 Sep 25, 2026
1.0.3 Stable 8–11 May 27, 2026
1.0.2 Stable 8–11 Nov 21, 2024
1.0.1 Stable 8–10 Jun 4, 2024
1.x-dev Dev 8–11 May 30, 2024