SU-SWS/stanford_publication

View on GitHub
config/optional/migrate_plus.migration.stanford_publications.yml

Summary

Maintainability
Test Coverage
langcode: en
status: true
dependencies:
  module:
    - migrate_source_csv
    - stanford_migrate
id: stanford_publications
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags: {  }
migration_group: default
label: 'Stanford Publications Importer'
source:
  plugin: csv
  path: /tmp/foo.csv
  ids:
    - id
  constants:
    status: 1
    basic_html: stanford_html
    minimal_html: stanford_minimal_html
  fields:
    -
      name: id
      label: ID
      selector: id
    -
      name: title
      label: Title
      selector: title
    -
      name: topics
      label: 'Topic Terms'
      selector: topics
    -
      name: ctaUrl
      label: 'CTA Button URL'
      selector: ctaUrl
    -
      name: ctaTitle
      label: 'CTA Button Title'
      selector: ctaTitle
    -
      name: body
      label: 'Text Body'
      selector: body
    -
      name: citationType
      label: 'Citation Type'
      selector: citationType
    -
      name: authors
      label: Author(s)
      selector: authors
    -
      name: month
      label: Month
      selector: month
    -
      name: day
      label: Day
      selector: day
    -
      name: year
      label: Year
      selector: year
    -
      name: doi
      label: DOI
      selector: doi
    -
      name: edition
      label: Edition
      selector: edition
    -
      name: genre
      label: Genre
      selector: genre
    -
      name: issue
      label: Issue
      selector: issue
    -
      name: page
      label: Page(s)
      selector: page
    -
      name: pubPlace
      label: 'Publication Place'
      selector: pubPlace
    -
      name: publisher
      label: Publisher
      selector: publisher
    -
      name: subtitle
      label: Subtitle
      selector: subtitle
    -
      name: volume
      label: Volume
      selector: volume
    -
      name: url
      label: 'External Source URL'
      selector: url
process:
  title: title
  status:
    plugin: default_value
    source: published
    default_value: 1
  su_publication_cta/uri: ctaUrl
  su_publication_cta/title: ctaTitle
  su_publication_topics:
    -
      plugin: skip_on_empty
      source: topics
      method: process
    -
      plugin: explode
      delimiter: '|'
    -
      plugin: entity_generate
      entity_type: taxonomy_term
      bundle_key: vid
      bundle: stanford_publication_topics
      value_key: name
      ignore_case: true
  su_publication_text_area:
    -
      plugin: skip_on_empty
      source: body
      method: process
    -
      plugin: entity_revision_generate
      entity_type: paragraph
      bundle_key: type
      bundle: stanford_wysiwyg
      value_key: su_wysiwyg_text
      ignore_case: true
      values:
        su_wysiwyg_text/value: body
        su_wysiwyg_text/format: constants/basic_html
  text_area_target_id:
    -
      plugin: skip_on_empty
      source: '@su_publication_text_area'
      method: process
    -
      plugin: extract
      index:
        - 0
  text_area_target_revision_id:
    -
      plugin: skip_on_empty
      source: '@su_publication_text_area'
      method: process
    -
      plugin: extract
      index:
        - 1
  su_publication_components:
    -
      plugin: skip_on_empty
      source: '@text_area_target_id'
      method: process
    -
      plugin: entity_revision_generate
      entity_type: paragraph_row
      bundle_key: type
      bundle: su_pub_rows
      value_key: su_pubs_components
      ignore_case: true
      values:
        su_pubs_components/target_id: '@text_area_target_id'
        su_pubs_components/target_revision_id: '@text_area_target_revision_id'
  citation_url:
    plugin: url_check
    source: url
    method: process
  citation_authors:
    -
      plugin: skip_on_empty
      source: authors
      method: process
    -
      plugin: explode
      delimiter: '|'
    -
      plugin: name_field
  su_publication_citation:
    -
      plugin: skip_on_empty
      source: citationType
      method: process
    -
      plugin: gate
      use_as_key: citationType
      key_direction: unlock
      valid_keys:
        - su_article_newspaper
        - su_book
        - su_article_journal
        - su_other
        - su_thesis
    -
      plugin: entity_generate_no_lookup
      source: title
      entity_type: citation
      bundle_key: type
      bundle: su_other
      value_key: title
      ignore_case: true
      values:
        title: title
        type: citationType
        su_day: day
        su_month: month
        su_year: year
        su_doi: doi
        su_edition: edition
        su_genre: genre
        su_issue: issue
        su_page: page
        su_publisher_place: pubPlace
        su_publisher: publisher
        su_subtitle: subtitle
        su_volume: volume
        su_url: '@citation_url'
        su_author: '@citation_authors'
destination:
  plugin: 'entity:node'
  default_bundle: stanford_publication
migration_dependencies:
  required: {  }