config/sync/migrate_plus.migration_group.courses.yml
uuid: 7ddacf63-eacf-4f80-8102-887623fe8091
langcode: en
status: true
dependencies: { }
id: courses
label: Courses
description: 'Course Importers.'
source_type: null
module: null
shared_configuration:
source:
track_changes: true
plugin: url
data_fetcher_plugin: http
data_parser_plugin: simple_xml
item_selector: //courses/course
orphan_action: delete
constants:
status: 1
type: su_opportunity
basic_html: stanford_html
image_destination: 'public://media/image/courses/'
apply_link_title: Apply
learn_more_link_title: 'Learn More'
image_alt: ''
link: 'http://explorecourses.stanford.edu/search?q='
fields:
-
name: course_id
label: 'Course ID'
selector: administrativeInformation/courseId
-
name: code
label: Code
selector: code
-
name: subject
label: Subject
selector: subject
-
name: title
label: Title
selector: title
-
name: body
label: Body
selector: description
-
name: time_of_year
label: 'Time of Year'
selector: './/attributes/attribute/name[text()=''NQTR'']/following-sibling::description'
-
name: academic_career
label: 'Academic Career'
selector: administrativeInformation/academicCareer
-
name: start_date
label: 'Start Date'
selector: '(.//startDate)[1]'
ids:
course_id:
type: string
code:
type: string
process:
title:
-
plugin: str_replace
source: title
search: '/\(.*?\)/'
replace: ''
regex: true
-
plugin: callback
callable: trim
revision_translation_affected:
-
plugin: default_value
default_value: 1
revision_timestamp:
plugin: callback
callable: _stanford_migrate_get_time
status: constants/status
type: constants/type
body/value: body
body/format: constants/basic_html
su_opp_course_code:
-
plugin: str_replace
source: title
search: '/^.*\((.*)\).*/'
replace: $1
regex: true
-
plugin: callback
callable: trim
su_opp_time_year:
-
plugin: skip_on_empty
method: process
source: time_of_year
-
plugin: str_replace
search:
- 'alternate years, given next year'
- 'alternate years, not given next year'
- Anytime
- 'not given this year'
- 'offered once only'
replace: ''
-
plugin: entity_generate
value_key: name
bundle_key: vid
bundle: su_opportunity_time
entity_type: taxonomy_term
ignore_case: true
-
plugin: deduplicate_array
su_opp_deadline_time:
-
plugin: skip_on_empty
method: process
source: time_of_year
-
plugin: str_replace
search:
- 'alternate years, given next year'
- 'alternate years, not given next year'
- Anytime
- 'not given this year'
- 'offered once only'
replace: ''
-
plugin: entity_generate
value_key: name
bundle_key: vid
bundle: su_opportunity_deadline
entity_type: taxonomy_term
ignore_case: true
-
plugin: deduplicate_array
su_opp_course_date:
-
plugin: format_date
source: start_date
from_format: 'M j, Y'
to_format: Y-m-d
su_opp_application_deadline:
-
plugin: skip_on_empty
source: '@su_opp_course_date'
method: process
-
plugin: format_date
from_format: Y-m-d
to_format: 'Y-m-d\T07:00:00'
su_opp_commitment:
-
plugin: default_value
default_value: 'Quarter-long course'
-
plugin: entity_generate
value_key: name
bundle_key: vid
bundle: su_opportunity_commitment
entity_type: taxonomy_term
ignore_case: true
su_opp_type:
-
plugin: default_value
default_value: 'Courses for Credit'
-
plugin: entity_generate
value_key: name
bundle_key: vid
bundle: su_opportunity_type
entity_type: taxonomy_term
ignore_case: true
su_opp_open_to:
-
plugin: skip_on_empty
method: process
source: academic_career
-
plugin: str_replace
search:
- UG
- GR
replace:
- Undergraduates
- 'Graduate Students'
-
plugin: entity_generate
value_key: name
bundle_key: vid
bundle: su_opportunity_open_to
entity_type: taxonomy_term
ignore_case: true
su_opp_location:
-
plugin: default_value
default_value: Stanford
-
plugin: entity_generate
value_key: name
bundle_key: vid
bundle: su_opportunity_location
entity_type: taxonomy_term
ignore_case: true
su_opp_dimension:
-
plugin: default_value
default_value: 'Cardinal Courses'
-
plugin: entity_generate
value_key: name
bundle_key: vid
bundle: su_opportunity_dimension
entity_type: taxonomy_term
ignore_case: true
link_query:
-
plugin: concat
source:
- subject
- code
-
plugin: urlencode
su_opp_learn_more/title: constants/learn_more_link_title
su_opp_learn_more/uri:
-
plugin: concat
source:
- constants/link
- '@link_query'
su_opp_solo_url/uri: '@su_opp_learn_more/uri'
su_opp_solo_url/title: constants/learn_more_link_title
destination:
plugin: 'entity_reference_revisions:node'
new_revisions: true
force_revision: true
overwrite_properties:
- title
- type
- body/value
- body/format
- su_opp_course_code
- su_opp_time_year
- su_opp_deadline_time
- su_opp_course_date
- su_opp_application_deadline
- su_opp_commitment
- su_opp_type
- su_opp_open_to
- su_opp_location
- su_opp_dimension
- su_opp_learn_more/title
- su_opp_learn_more/uri
- su_opp_solo_url/uri
- su_opp_solo_url/title
- su_opp_service_theme
migration_dependencies:
required: { }