uuid: a3812d6e-7a67-4110-bb47-d1062709f806
langcode: fr
status: true
dependencies:
  - migrate_google_sheets
  - migrate_plus
id: projet_node
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags: null
migration_group: le_shed
label: 'Import des projets depuis Google Sheets'
source:
  plugin: projet_node
  data_fetcher_plugin: http
  data_parser_plugin: google_sheets
  constants:
    images_destination: 'public://projets/'
  urls: 'https://sheets.googleapis.com/v4/spreadsheets/1561Gv1C-IlCTmg64Z8HnznvOeLbvwhA_k1l6aq95zFA/values/Projets'
  fields:
    -
      name: id
      label: 'Unique identifier'
      selector: UID
    -
      name: title
      label: Title
      selector: 'Nom du projet'
    -
      name: date_start
      label: 'Date start'
      selector: 'Date de début de projet'
    -
      name: date_end
      label: 'Date end'
      selector: 'Date de fin de projet'
    -
      name: projet_type
      label: 'Type de projet'
      selector: 'Type de projet'
    -
      name: curator
      label: Commissaria
      selector: 'invité/accompagné/curaté par'
    -
      name: artistes
      label: 'Artistes invité·es'
      selector: 'Artistes invité·es'
    -
      name: partners
      label: 'Partenaires associés'
      selector: 'Partenaires associés'
  ids:
    id:
      type: integer
process:
  type:
    plugin: default_value
    default_value: projet
  title:
    plugin: skip_on_empty
    method: row
    source: title
    message: 'Projet ignoré : « Nom du projet » vide.'
  body/value: body_html
  body/format:
    plugin: default_value
    default_value: wysiwyg
  field_images:
    plugin: sub_process
    source: images
    process:
      target_id:
        plugin: image_resize_import
        source: uri
        destination: destination
        max_width: 1920
        max_height: 1920
        reuse: true
        skip_on_missing_source: true
      alt: alt
      image_field_caption/value: caption
      image_field_caption/format:
        plugin: default_value
        default_value: wysiwyg
  field_fichiers:
    plugin: sub_process
    source: pdfs
    process:
      target_id:
        plugin: file_import
        source: uri
        destination: destination
        reuse: true
        skip_on_missing_source: true
      description: description
  field_dates/value:
    plugin: leshed_date
    source: date_start
  field_dates/end_value:
    plugin: leshed_date
    source: date_end
    end_of_year: true
    fallback_source: date_start
  field_type_de_projet:
    -
      plugin: skip_on_empty
      method: process
      source: projet_type
    -
      plugin: explode
      delimiter: ','
    -
      plugin: callback
      callable: trim
    -
      plugin: entity_generate
      entity_type: taxonomy_term
      bundle_key: vid
      bundle: type_de_projet
      value_key: name
  field_invite_accompagne_curate_p:
    -
      plugin: skip_on_empty
      method: process
      source: curator
    -
      plugin: personne_generate
      type_de_personne: curateur
  field_artiste_s_invite_s:
    -
      plugin: skip_on_empty
      method: process
      source: artistes
    -
      plugin: personne_generate
      type_de_personne: artiste
  field_partenaire_s:
    -
      plugin: skip_on_empty
      method: process
      source: partners
    -
      plugin: partenaire_generate
  uid:
    plugin: default_value
    default_value: 3
destination:
  plugin: 'entity:node'
idMap: {  }
migration_dependencies: {  }
include: null
