146 lines
3.3 KiB
YAML
146 lines
3.3 KiB
YAML
|
|
# Migration configuration for importing profile pages.
|
||
|
|
id: cdesai_profile_pages
|
||
|
|
label: Import Profile Pages from CSV
|
||
|
|
migration_group: CDESAI
|
||
|
|
|
||
|
|
source:
|
||
|
|
# The custom CSV source plugin will fetch the source path from configs.
|
||
|
|
# Upload source files at /admin/config/development/cdesai/migrate.
|
||
|
|
plugin: 'cdesai_migrate_csv'
|
||
|
|
source_config_key: cdesai_migrate_profile_pages_source
|
||
|
|
|
||
|
|
delimiter: ','
|
||
|
|
enclosure: '"'
|
||
|
|
header_offset: 0
|
||
|
|
|
||
|
|
ids:
|
||
|
|
- page
|
||
|
|
|
||
|
|
process:
|
||
|
|
langcode: en
|
||
|
|
moderation_state: draft
|
||
|
|
title: title
|
||
|
|
field_legacy_url: legacy_url
|
||
|
|
field_year_birth: year_birth
|
||
|
|
field_year_death: year_death
|
||
|
|
|
||
|
|
uid:
|
||
|
|
plugin: default_value
|
||
|
|
default_value: 1
|
||
|
|
|
||
|
|
body/value:
|
||
|
|
# Skips a row if skip_migration property is set to TRUE.
|
||
|
|
-
|
||
|
|
plugin: skip_on_value
|
||
|
|
equals: true
|
||
|
|
source: skip_migration
|
||
|
|
value: 'TRUE'
|
||
|
|
method: row
|
||
|
|
# Skips a row if scrapped property is set to FALSE.
|
||
|
|
-
|
||
|
|
plugin: skip_on_value
|
||
|
|
equals: true
|
||
|
|
source: scrapped
|
||
|
|
value: 'FALSE'
|
||
|
|
method: row
|
||
|
|
-
|
||
|
|
plugin: migration_lookup
|
||
|
|
migration: cdesai_paragraphs
|
||
|
|
no_stub: true
|
||
|
|
source: page
|
||
|
|
-
|
||
|
|
plugin: extract_cdesai_migrate_paragraph
|
||
|
|
|
||
|
|
field_body/format:
|
||
|
|
plugin: default_value
|
||
|
|
default_value: rich_text
|
||
|
|
|
||
|
|
field_position:
|
||
|
|
# Do not process further if the position value is empty.
|
||
|
|
-
|
||
|
|
plugin: skip_on_value
|
||
|
|
equals: true
|
||
|
|
source: position
|
||
|
|
value: ''
|
||
|
|
method: process
|
||
|
|
|
||
|
|
# The plugin looks up for an exiting term based on the value_key property.
|
||
|
|
# If no matching term is found, it creates one on the fly.
|
||
|
|
-
|
||
|
|
plugin: entity_generate
|
||
|
|
source: position
|
||
|
|
entity_type: taxonomy_term
|
||
|
|
bundle_key: vid
|
||
|
|
bundle: position
|
||
|
|
value_key: name
|
||
|
|
ignore_case: true
|
||
|
|
|
||
|
|
field_agency:
|
||
|
|
# Do not process further if the position value is empty.
|
||
|
|
-
|
||
|
|
plugin: skip_on_value
|
||
|
|
equals: true
|
||
|
|
source: agency
|
||
|
|
value: ''
|
||
|
|
method: process
|
||
|
|
|
||
|
|
# The plugin looks up for an exiting term based on the value_key property.
|
||
|
|
# If no matching term is found, it creates one on the fly.
|
||
|
|
-
|
||
|
|
plugin: entity_generate
|
||
|
|
source: agency
|
||
|
|
entity_type: taxonomy_term
|
||
|
|
bundle_key: vid
|
||
|
|
bundle: agency
|
||
|
|
value_key: name
|
||
|
|
ignore_case: true
|
||
|
|
|
||
|
|
field_years_in_office:
|
||
|
|
-
|
||
|
|
plugin: skip_on_empty
|
||
|
|
source: years_in_office
|
||
|
|
method: process
|
||
|
|
message: 'Row does not contain years_in_office.'
|
||
|
|
-
|
||
|
|
plugin: explode
|
||
|
|
delimiter: ','
|
||
|
|
-
|
||
|
|
plugin: callback
|
||
|
|
callable: trim
|
||
|
|
|
||
|
|
field_media/target_id:
|
||
|
|
# Skips a row if has_images property is set to FALSE.
|
||
|
|
-
|
||
|
|
plugin: skip_on_value
|
||
|
|
equals: true
|
||
|
|
source: has_images
|
||
|
|
value: 'FALSE'
|
||
|
|
method: row
|
||
|
|
-
|
||
|
|
plugin: skip_on_empty
|
||
|
|
method: row
|
||
|
|
message: 'Cannot import image file with an empty url.'
|
||
|
|
-
|
||
|
|
plugin: migration_lookup
|
||
|
|
migration: cdesai_profile_pages_media_items
|
||
|
|
source: page
|
||
|
|
|
||
|
|
type:
|
||
|
|
plugin: default_value
|
||
|
|
default_value: profile
|
||
|
|
|
||
|
|
destination:
|
||
|
|
plugin: 'entity:node'
|
||
|
|
|
||
|
|
# make sure these migration execute before running current migration
|
||
|
|
migration_dependencies:
|
||
|
|
required:
|
||
|
|
- cdesai_profile_pages_media_items
|
||
|
|
- cdesai_basic_pages
|
||
|
|
|
||
|
|
# use forced module dependency so uninstall/reinstall works properly
|
||
|
|
dependencies:
|
||
|
|
enforced:
|
||
|
|
module:
|
||
|
|
- cdesai_migrate
|