Skip to content

Commit

Permalink
release(1.9.0): add piano di studi demo
Browse files Browse the repository at this point in the history
  • Loading branch information
arturu committed Feb 5, 2024
1 parent 758bc6f commit 2d5bdce
Show file tree
Hide file tree
Showing 4 changed files with 230 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
id: demo_paragraph_call_to_action
label: Tipo di contenuto Partner
label: Paragrafo Call to action
migration_group: scuola_demo
migration_tags:
- json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
id: demo_paragraph_piano_di_studi
label: Paragrafo piano di studi
migration_group: scuola_demo
migration_tags:
- json
- scuola
- demo
- demo_paragraph
- demo_paragraph_piano_di_studi

source:
plugin: url
data_fetcher_plugin: http
data_parser_plugin: json

headers:
Accept: 'application/json; charset=utf-8'
Content-Type: 'application/json'

# The data_parser normally limits the fields passed on to the source plugin
# to fields configured to be used as part of the migration. To support more
# dynamic migrations, the JSON data parser supports including the original
# data for the current row. Simply include the 'include_raw_data' flag set
# to `true` to enable this. This option is disabled by default to minimize
# memory footprint for migrations that do not need this capability.
# include_raw_data: false

# Flags whether to track changes to incoming data. If TRUE, we will maintain
# hashed source rows to determine whether incoming data has changed.
# track_changes: false

urls:
- 'https://ouitoulia.github.io/krene/demo/paragraph_piano_di_studi.json'

# An xpath-like selector corresponding to the items to be imported.
item_selector: data

fields:
- name: id
label: 'ID del paragrafo'
selector: id
- name: type
label: 'Il tipo di paragrafo'
selector: type

# Campi
- name: tipo_periodo
label: "Il tipo di periodo"
selector: attributes/tipo_periodo
- name: periodo
label: "Il periodo"
selector: attributes/periodo
- name: kicker
label: "L'intestazione'"
selector: attributes/kicker
- name: text
label: "Le note"
selector: attributes/text
- name: piano_di_studi_item
label: "I paragrafi piano di studi item collegati"
selector: relationships/piano_di_studi_item/data/paragraph

# Footer
- name: language
label: 'La lingua del contenuto'
selector: language

ids:
id:
type: integer

process:
id: id
type: type

# Campi
field_tipo_periodo: tipo_periodo
field_periodo: periodo
field_kicker: kicker
field_text: text
_piano_di_studi_item:
plugin: migration_lookup
migration: demo_paragraph_piano_di_studi_item
source: piano_di_studi_item
field_piano_di_studi_item:
plugin: sub_process
source: '@_piano_di_studi_item'
process:
target_id: '0'
target_revision_id: '1'

# Footer
langcode:
plugin: default_value
source: language
default_value: "und"

destination:
plugin: 'entity_reference_revisions:paragraph'
default_bundle: piano_di_studi

migration_dependencies:
required:
- taxonomy_common
- piano_di_studi_item

dependencies:
enforced:
module:
- sunchronizo

Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
id: demo_paragraph_piano_di_studi_item
label: Paragrafo piano di studi item
migration_group: scuola_demo
migration_tags:
- json
- scuola
- demo
- demo_paragraph
- demo_paragraph_piano_di_studi_item

source:
plugin: url
data_fetcher_plugin: http
data_parser_plugin: json

headers:
Accept: 'application/json; charset=utf-8'
Content-Type: 'application/json'

# The data_parser normally limits the fields passed on to the source plugin
# to fields configured to be used as part of the migration. To support more
# dynamic migrations, the JSON data parser supports including the original
# data for the current row. Simply include the 'include_raw_data' flag set
# to `true` to enable this. This option is disabled by default to minimize
# memory footprint for migrations that do not need this capability.
# include_raw_data: false

# Flags whether to track changes to incoming data. If TRUE, we will maintain
# hashed source rows to determine whether incoming data has changed.
# track_changes: false

urls:
- 'https://ouitoulia.github.io/krene/demo/paragraph_piano_di_studi_item.json'

# An xpath-like selector corresponding to the items to be imported.
item_selector: data

fields:
- name: id
label: 'ID del paragrafo'
selector: id
- name: type
label: 'Il tipo di paragrafo'
selector: type

# Campi
- name: materia
label: "La materia collegata alla tassonomia"
selector: relationships/materia/data/id
- name: ore_settimanali
label: "Le ore settimanali"
selector: attributes/ore_settimanali
- name: monte_ore
label: "Il monte ore annuale"
selector: attributes/monte_ore

# Footer
- name: language
label: 'La lingua del contenuto'
selector: language

ids:
id:
type: integer

process:
id: id
type: type

# Campi
field_materia: materia
field_ore_settimanali: ore_settimanali
field_monte_ore: monte_ore

# Footer
langcode:
plugin: default_value
source: language
default_value: "und"

destination:
plugin: 'entity_reference_revisions:paragraph'
default_bundle: piano_di_studi_item

migration_dependencies:
required:
- taxonomy_common

dependencies:
enforced:
module:
- sunchronizo

36 changes: 25 additions & 11 deletions config/install/migrate_plus.migration.demo_percorso_di_studio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ source:
- name: abstract
label: 'Descrizione breve'
selector: attributes/abstract
- name: struttura_didattica
label: 'La struttura didattica responsabile del percorso di studio'
selector: relationships/struttura_didattica/data

# Scheda "Co'è e cosa serve"
- name: cosa_e
Expand All @@ -69,9 +72,9 @@ source:
selector: attributes/a_cosa_serve

# Scheda "Frequentare"
- name: struttura_didattica
label: 'La struttura didattica responsabile del percorso di studio'
selector: relationships/struttura_didattica/data
- name: piano_di_studio
label: "Il piano di studio associato al percorso"
selector: relationships/piano_di_studio/data/paragraph

# Scheda "Accesso"
- name: come_si_accede
Expand Down Expand Up @@ -131,6 +134,14 @@ process:
source: copertina
method: process
field_abstract: abstract
field_struttura_didattica:
- plugin: skip_on_empty
source: struttura_didattica
method: process
- plugin: sub_process
source: struttura_didattica
process:
target_id: id

# Scheda "Co'è e cosa serve"
field_cosa_e:
Expand All @@ -146,14 +157,16 @@ process:
default_value: bootstrap_italia_2

# Scheda "Frequentare"
field_struttura_didattica:
- plugin: skip_on_empty
source: struttura_didattica
method: process
- plugin: sub_process
source: struttura_didattica
process:
target_id: id
_piano_di_studio:
plugin: migration_lookup
migration: demo_paragraph_piano_di_studi
source: piano_di_studio
field_piano_di_studio:
plugin: sub_process
source: '@_piano_di_studio'
process:
target_id: '0'
target_revision_id: '1'

# Scheda "Accesso"
field_come_si_accede:
Expand Down Expand Up @@ -232,6 +245,7 @@ migration_dependencies:
- demo_luoghi
- demo_struttura_organizzativa
- demo_servizio
- demo_paragraph_piano_di_studi

dependencies:
enforced:
Expand Down

0 comments on commit 2d5bdce

Please sign in to comment.