langcode: en
status: true
dependencies:
  enforced:
    module:
      - farm_lab_test
      - farm_migrate
id: farm_migrate_log_lab_test
label: 'Logs (Lab tests)'
migration_group: farm_migrate_log
migration_tags:
  - 'Drupal 7'
  - 'farmOS 1.x'
class: Drupal\migrate\Plugin\Migration
field_plugin_method: null
cck_plugin_method: null
source:
  plugin: d7_farm_log
  bundle:
    - farm_soil_test
    - farm_water_test
destination:
  plugin: 'entity:log'
process:
  # Hard-code the bundle.
  type:
    plugin: default_value
    default_value: lab_test
  # Maintain the log ID.
  id:
    plugin: get
    source: id
  # Migrate log quantities.
  quantity:
    plugin: get
    source: '@_log_quantities'
  # Lab test specific fields.
  lab:
    -
      plugin: get_lab
    -
      plugin: skip_on_empty
      method: process
    -
      plugin: entity_generate
      value_key: name
      entity_type: taxonomy_term
      bundle_key: vid
      bundle: lab
  lab_test_type:
    plugin: static_map
    source: type
    map:
      farm_soil_test: soil
      farm_water_test: water
  # Concatenate the 1.x "Soil names" field summary into Notes.
  notes/0/value:
    plugin: concat
    source:
      - field_farm_notes/0/value
      - soil_name_summary
  notes/0/format:
    plugin: static_map
    source: field_farm_notes/0/format
    map:
      farm_format: default
      plain_text: plain_text
    default_value: default
migration_dependencies:
  required: {  }
  optional: {  }
