SU-HKKU/cardinal_service_profile

View on GitHub
config/sync/migrate_plus.migration.csv_opportunities.yml

Summary

Maintainability
Test Coverage
uuid: 9a0d77ad-0009-46f6-b9ee-5b99fc6b22a3
langcode: en
status: true
dependencies: {  }
id: csv_opportunities
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags: {  }
migration_group: csv_importers
label: 'CSV Opportunities'
source:
  plugin: csv
  path: /tmp/foo.csv
  constants:
    status: 1
    type: su_opportunity
    basic_html: stanford_html
    minimal_html: stanford_minimal_html
    image_destination: 'public://media/image/csv/'
    apply_link_title: Apply
    learn_more_link_title: 'Learn More'
    image_alt: ''
  fields:
    -
      name: id
      label: 'ID *Required'
      selector: id
    -
      name: existing_nid
      label: 'Existing Content ID Number'
      selector: existing_id
    -
      name: status
      label: Status
      selector: status
    -
      name: title
      label: 'Title *Required'
      selector: title
    -
      name: summary
      label: Summary
      selector: summary
    -
      name: body
      label: Body
      selector: body
    -
      name: url
      label: 'Learn More Link URL'
      selector: learn_more_url
    -
      name: application_deadline
      label: 'Application Deadline (Date and time)'
      selector: application_deadline_date
    -
      name: application_deadline_quarter
      label: 'Application Deadline (Quarter of the year)'
      selector: application_deadline_quarter
    -
      name: time_of_year
      label: 'Time of the Year'
      selector: time
    -
      name: image
      label: 'Image URL'
      selector: image_url
    -
      name: eligibility
      label: Eligibility
      selector: eligibility
    -
      name: opportunity_type
      label: 'Type of Opportunity'
      selector: opportunity_type
    -
      name: open_to
      label: 'Open To'
      selector: open_to
    -
      name: location
      label: Location
      selector: location
    -
      name: contact_name
      label: 'Contact Name'
      selector: contact_name
    -
      name: contact_email
      label: 'Contact Email'
      selector: contact_email
    -
      name: contact_phone
      label: 'Contact Phone Number'
      selector: contact_phone
    -
      name: service_theme
      label: 'Service Theme'
      selector: service_theme
    -
      name: program
      label: Program
      selector: program
    -
      name: pathway
      label: Pathway
      selector: pathway
    -
      name: placement_type
      label: 'Placement Type'
      selector: placement_type
    -
      name: sponsor
      label: Sponsor
      selector: sponsor
    -
      name: time_commitment
      label: 'Time Commitment'
      selector: time_commitment
  ids:
    - id
process:
  nid: existing_nid
  title: title
  revision_translation_affected:
    -
      plugin: default_value
      default_value: 1
  revision_timestamp:
    plugin: callback
    callable: _stanford_migrate_get_time
  status:
    plugin: default_value
    source: status
    default_value: 1
    strict: true
  type: constants/type
  body/value: body
  body/format: constants/basic_html
  su_opp_summary/value: summary
  su_opp_summary/format: constants/minimal_html
  su_opp_contact_email: contact_email
  su_opp_contact_name: contact_name
  su_opp_contact_phone: contact_phone
  su_opp_eligibility/value: eligibility
  su_opp_eligibility/format: constants/basic_html
  su_opp_solo_url/uri: url
  su_opp_learn_more/uri: url
  su_opp_learn_more/title: constants/learn_more_link_title
  su_opp_dimension:
    source: program
    plugin: entity_generate
    value_key: name
    bundle_key: vid
    bundle: su_opportunity_dimension
    entity_type: taxonomy_term
    ignore_case: true
  su_opp_service_theme:
    -
      plugin: skip_on_empty
      source: service_theme
      method: process
    -
      plugin: explode
      delimiter: ;
    -
      plugin: callback
      callable: trim
    -
      plugin: entity_generate
      value_key: name
      bundle_key: vid
      bundle: su_opportunity_service_theme
      entity_type: taxonomy_term
      ignore_case: true
  su_opp_solo_url/title:
    -
      plugin: skip_on_empty
      source: url
      method: process
    -
      plugin: callback
      source: constants/apply_link_title
      callable: ucfirst
  su_opp_location:
    -
      plugin: skip_on_empty
      source: location
      method: process
    -
      plugin: explode
      delimiter: ;
    -
      plugin: callback
      callable: trim
    -
      plugin: entity_generate
      value_key: name
      bundle_key: vid
      bundle: su_opportunity_location
      entity_type: taxonomy_term
      ignore_case: true
  su_opp_open_to:
    -
      plugin: skip_on_empty
      source: open_to
      method: process
    -
      plugin: explode
      delimiter: ;
    -
      plugin: callback
      callable: trim
    -
      plugin: entity_generate
      value_key: name
      bundle_key: vid
      bundle: su_opportunity_open_to
      entity_type: taxonomy_term
      ignore_case: true
    -
      plugin: deduplicate_array
  su_opp_time_year:
    -
      plugin: skip_on_empty
      source: time_of_year
      method: process
    -
      plugin: explode
      delimiter: ;
    -
      plugin: callback
      callable: trim
    -
      plugin: entity_generate
      value_key: name
      bundle_key: vid
      bundle: su_opportunity_time
      entity_type: taxonomy_term
      ignore_case: true
  image_file:
    -
      plugin: skip_on_empty
      method: process
      source: image
    -
      plugin: file_import
      destination: constants/image_destination
      id_only: true
      reuse: true
  su_opp_image/target_id:
    -
      plugin: skip_on_empty
      method: process
      source: image
    -
      plugin: skip_on_empty
      method: process
      source: '@image_file'
    -
      plugin: entity_generate
      source: title
      value_key: name
      bundle_key: bundle
      bundle: image
      entity_type: media
      ignore_case: true
      values:
        field_media_image/target_id: '@image_file'
        field_media_image/alt: constants/image_alt
        field_media_image/title: constants/image_alt
  su_opp_application_deadline:
    -
      plugin: skip_on_empty
      method: process
      source: application_deadline
    -
      plugin: callback
      callable: strtotime
    -
      plugin: format_date
      from_format: U
      to_format: 'Y-m-d\TH:i:s'
      from_timezone: America/Los_Angeles
      to_timezone: UTC
      settings:
        validate_format: false
  application_deadline_quarter:
    -
      plugin: skip_on_empty
      method: process
      source: application_deadline_quarter
    -
      plugin: entity_generate
      value_key: name
      bundle_key: vid
      bundle: su_opportunity_time
      entity_type: taxonomy_term
      ignore_case: true
  su_opp_pathway:
    -
      plugin: skip_on_empty
      source: pathway
      method: process
    -
      plugin: explode
      delimiter: ;
    -
      plugin: callback
      callable: trim
    -
      plugin: entity_generate
      value_key: name
      bundle_key: vid
      bundle: su_opportunity_pathway
      entity_type: taxonomy_term
      ignore_case: true
  su_opp_placement_type:
    -
      plugin: skip_on_empty
      source: placement_type
      method: process
    -
      plugin: explode
      delimiter: ;
    -
      plugin: callback
      callable: trim
    -
      plugin: entity_generate
      value_key: name
      bundle_key: vid
      bundle: su_opportunity_placement_type
      entity_type: taxonomy_term
      ignore_case: true
  su_opp_type:
    -
      plugin: skip_on_empty
      source: opportunity_type
      method: process
    -
      plugin: explode
      delimiter: ;
    -
      plugin: callback
      callable: trim
    -
      plugin: entity_generate
      value_key: name
      bundle_key: vid
      bundle: su_opportunity_type
      entity_type: taxonomy_term
      ignore_case: true
  su_opp_sponsor:
    -
      plugin: skip_on_empty
      source: sponsor
      method: process
    -
      plugin: explode
      delimiter: ;
    -
      plugin: callback
      callable: trim
    -
      plugin: entity_generate
      value_key: name
      bundle_key: vid
      bundle: su_opportunity_sponsor
      entity_type: taxonomy_term
      ignore_case: true
  su_opp_commitment:
    -
      plugin: skip_on_empty
      source: time_commitment
      method: process
    -
      plugin: explode
      delimiter: ;
    -
      plugin: callback
      callable: trim
    -
      plugin: entity_generate
      value_key: name
      bundle_key: vid
      bundle: su_opportunity_commitment
      entity_type: taxonomy_term
      ignore_case: true
destination:
  plugin: 'entity_reference_revisions:node'
  new_revisions: true
  force_revision: true
migration_dependencies:
  required: {  }