From 2d5bdceb45a49c5323ec1bcb04fc83434e8848a0 Mon Sep 17 00:00:00 2001 From: arturu Date: Mon, 5 Feb 2024 11:36:33 +0100 Subject: [PATCH] release(1.9.0): add piano di studi demo --- ...igration.demo_paragraph_call_to_action.yml | 2 +- ...igration.demo_paragraph_piano_di_studi.yml | 111 ++++++++++++++++++ ...ion.demo_paragraph_piano_di_studi_item.yml | 93 +++++++++++++++ ...plus.migration.demo_percorso_di_studio.yml | 36 ++++-- 4 files changed, 230 insertions(+), 12 deletions(-) create mode 100644 config/install/migrate_plus.migration.demo_paragraph_piano_di_studi.yml create mode 100644 config/install/migrate_plus.migration.demo_paragraph_piano_di_studi_item.yml diff --git a/config/install/migrate_plus.migration.demo_paragraph_call_to_action.yml b/config/install/migrate_plus.migration.demo_paragraph_call_to_action.yml index 7329d00..e866e6d 100644 --- a/config/install/migrate_plus.migration.demo_paragraph_call_to_action.yml +++ b/config/install/migrate_plus.migration.demo_paragraph_call_to_action.yml @@ -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 diff --git a/config/install/migrate_plus.migration.demo_paragraph_piano_di_studi.yml b/config/install/migrate_plus.migration.demo_paragraph_piano_di_studi.yml new file mode 100644 index 0000000..90a0b09 --- /dev/null +++ b/config/install/migrate_plus.migration.demo_paragraph_piano_di_studi.yml @@ -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 + diff --git a/config/install/migrate_plus.migration.demo_paragraph_piano_di_studi_item.yml b/config/install/migrate_plus.migration.demo_paragraph_piano_di_studi_item.yml new file mode 100644 index 0000000..ddeec78 --- /dev/null +++ b/config/install/migrate_plus.migration.demo_paragraph_piano_di_studi_item.yml @@ -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 + diff --git a/config/install/migrate_plus.migration.demo_percorso_di_studio.yml b/config/install/migrate_plus.migration.demo_percorso_di_studio.yml index b98e1c5..cde196e 100644 --- a/config/install/migrate_plus.migration.demo_percorso_di_studio.yml +++ b/config/install/migrate_plus.migration.demo_percorso_di_studio.yml @@ -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 @@ -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 @@ -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: @@ -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: @@ -232,6 +245,7 @@ migration_dependencies: - demo_luoghi - demo_struttura_organizzativa - demo_servizio + - demo_paragraph_piano_di_studi dependencies: enforced: