popsu_migrate: D7NodeTheme type de themes ok
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
uuid: 109c9789-49c4-496b-9752-dbef07f4844f
 | 
			
		||||
uuid: 48293cc8-6d3e-4319-94d5-5a084cc43922
 | 
			
		||||
langcode: fr
 | 
			
		||||
status: true
 | 
			
		||||
dependencies: {  }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
uuid: 4f12194e-d946-4dac-951d-473619e7e1fa
 | 
			
		||||
uuid: 6792e7bc-de9a-426f-a025-2714ebdae9c6
 | 
			
		||||
langcode: fr
 | 
			
		||||
status: true
 | 
			
		||||
dependencies: {  }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,9 @@
 | 
			
		||||
uuid: 33fb807a-7941-481f-85c6-745336b34fde
 | 
			
		||||
uuid: da306ac3-31b7-48db-b5cd-bca61bed030d
 | 
			
		||||
langcode: fr
 | 
			
		||||
status: true
 | 
			
		||||
dependencies: {  }
 | 
			
		||||
_core:
 | 
			
		||||
  default_config_hash: rJxQh2W7x4hn1fMvgAiyjsdjG3SPO8Re_q5Zv15hgcQ
 | 
			
		||||
  default_config_hash: uXnA5dnBQRk7D5gA4_B-KY4azpiVJY8-B9E7aIwHb7A
 | 
			
		||||
id: d7_node_theme
 | 
			
		||||
class: null
 | 
			
		||||
field_plugin_method: null
 | 
			
		||||
@@ -46,9 +46,15 @@ process:
 | 
			
		||||
        no_stub: true
 | 
			
		||||
      alt: alt
 | 
			
		||||
      title: title
 | 
			
		||||
  field_type_de_theme:
 | 
			
		||||
    plugin: migration_lookup
 | 
			
		||||
    migration: d7_taxonomy_term_type_theme
 | 
			
		||||
    source: field_popsu_themtrans_type
 | 
			
		||||
    no_stub: true
 | 
			
		||||
destination:
 | 
			
		||||
  plugin: 'entity:node'
 | 
			
		||||
migration_dependencies:
 | 
			
		||||
  required:
 | 
			
		||||
    - d7_allpublicfiles
 | 
			
		||||
    - d7_users
 | 
			
		||||
    - d7_taxonomy_term_type_theme
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,43 @@
 | 
			
		||||
uuid: 5271f877-ecf0-43f0-8b85-935338468cb9
 | 
			
		||||
langcode: fr
 | 
			
		||||
status: true
 | 
			
		||||
dependencies: {  }
 | 
			
		||||
_core:
 | 
			
		||||
  default_config_hash: 8WKuGBlZ5qPBjASOe5KMfJVNAdp2h7h-cu46cvt-Q-s
 | 
			
		||||
id: d7_taxonomy_term_type_theme
 | 
			
		||||
class: null
 | 
			
		||||
field_plugin_method: null
 | 
			
		||||
cck_plugin_method: null
 | 
			
		||||
migration_tags:
 | 
			
		||||
  - 'Drupal 7'
 | 
			
		||||
  - Content
 | 
			
		||||
  - Popsu
 | 
			
		||||
migration_group: popsu
 | 
			
		||||
label: 'Taxonomy terms Type de theme'
 | 
			
		||||
source:
 | 
			
		||||
  plugin: d7_taxoterm_typetheme
 | 
			
		||||
  bundle: popsu_themtrans
 | 
			
		||||
process:
 | 
			
		||||
  vid:
 | 
			
		||||
    plugin: default_value
 | 
			
		||||
    default_value: types_de_theme
 | 
			
		||||
  name: name
 | 
			
		||||
  description/value: description
 | 
			
		||||
  description/format: format
 | 
			
		||||
  weight: weight
 | 
			
		||||
  parent_id:
 | 
			
		||||
    -
 | 
			
		||||
      plugin: skip_on_empty
 | 
			
		||||
      method: process
 | 
			
		||||
      source: parent
 | 
			
		||||
    -
 | 
			
		||||
      plugin: migration_lookup
 | 
			
		||||
      migration: d7_taxonomy_term_type_theme
 | 
			
		||||
  parent:
 | 
			
		||||
    plugin: default_value
 | 
			
		||||
    default_value: 0
 | 
			
		||||
    source: '@parent_id'
 | 
			
		||||
  changed: timestamp
 | 
			
		||||
destination:
 | 
			
		||||
  plugin: 'entity:taxonomy_term'
 | 
			
		||||
migration_dependencies: null
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
uuid: f4fce287-cf41-4cbd-bc42-d38df4c92f24
 | 
			
		||||
uuid: 7ec8eb78-7884-4c82-9996-ad70c1413c45
 | 
			
		||||
langcode: fr
 | 
			
		||||
status: true
 | 
			
		||||
dependencies: {  }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
uuid: 734983b5-c217-433d-ac9c-6c923c681360
 | 
			
		||||
uuid: 4723b02a-b61d-4833-bb03-b7a2dfa6b42e
 | 
			
		||||
langcode: fr
 | 
			
		||||
status: true
 | 
			
		||||
dependencies:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								config/sync/migrate_plus.migration_group.pospsu.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								config/sync/migrate_plus.migration_group.pospsu.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
uuid: b23aa4de-a0e2-4988-8e48-136de4554664
 | 
			
		||||
langcode: fr
 | 
			
		||||
status: true
 | 
			
		||||
dependencies: {  }
 | 
			
		||||
id: pospsu
 | 
			
		||||
label: pospsu
 | 
			
		||||
description: ''
 | 
			
		||||
source_type: null
 | 
			
		||||
module: null
 | 
			
		||||
shared_configuration: null
 | 
			
		||||
@@ -5,12 +5,15 @@ dependencies:
 | 
			
		||||
  config:
 | 
			
		||||
    - field.storage.node.field_image
 | 
			
		||||
    - field.storage.node.field_programme
 | 
			
		||||
    - field.storage.node.field_type_de_theme
 | 
			
		||||
    - image.style.thumbnail
 | 
			
		||||
    - node.type.programme
 | 
			
		||||
    - node.type.theme
 | 
			
		||||
    - taxonomy.vocabulary.types_de_theme
 | 
			
		||||
  module:
 | 
			
		||||
    - image
 | 
			
		||||
    - node
 | 
			
		||||
    - taxonomy
 | 
			
		||||
    - user
 | 
			
		||||
_core:
 | 
			
		||||
  default_config_hash: P7F4DFe8BL31DRVqsvS-ix9KZZqvvaPjZ7zEvGo9yNM
 | 
			
		||||
@@ -64,7 +67,9 @@ display:
 | 
			
		||||
          description: ''
 | 
			
		||||
          columns:
 | 
			
		||||
            node_bulk_form: node_bulk_form
 | 
			
		||||
            field_image: field_image
 | 
			
		||||
            title: title
 | 
			
		||||
            field_type_de_theme: title
 | 
			
		||||
            operations: title
 | 
			
		||||
            field_programme: field_programme
 | 
			
		||||
            status: status
 | 
			
		||||
@@ -75,6 +80,13 @@ display:
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            field_image:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            title:
 | 
			
		||||
              sortable: true
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
@@ -82,6 +94,13 @@ display:
 | 
			
		||||
              separator: '<br/>'
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            field_type_de_theme:
 | 
			
		||||
              sortable: false
 | 
			
		||||
              default_sort_order: asc
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
              empty_column: false
 | 
			
		||||
              responsive: ''
 | 
			
		||||
            operations:
 | 
			
		||||
              align: ''
 | 
			
		||||
              separator: ''
 | 
			
		||||
@@ -908,6 +927,62 @@ display:
 | 
			
		||||
            default_group_multiple: {  }
 | 
			
		||||
            group_items: {  }
 | 
			
		||||
          plugin_id: numeric
 | 
			
		||||
        field_type_de_theme_target_id:
 | 
			
		||||
          id: field_type_de_theme_target_id
 | 
			
		||||
          table: node__field_type_de_theme
 | 
			
		||||
          field: field_type_de_theme_target_id
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          operator: or
 | 
			
		||||
          value: {  }
 | 
			
		||||
          group: 1
 | 
			
		||||
          exposed: true
 | 
			
		||||
          expose:
 | 
			
		||||
            operator_id: field_type_de_theme_target_id_op
 | 
			
		||||
            label: 'Type de theme (field_type_de_theme)'
 | 
			
		||||
            description: ''
 | 
			
		||||
            use_operator: false
 | 
			
		||||
            operator: field_type_de_theme_target_id_op
 | 
			
		||||
            operator_limit_selection: false
 | 
			
		||||
            operator_list: {  }
 | 
			
		||||
            identifier: field_type_de_theme_target_id
 | 
			
		||||
            required: false
 | 
			
		||||
            remember: false
 | 
			
		||||
            multiple: false
 | 
			
		||||
            remember_roles:
 | 
			
		||||
              authenticated: authenticated
 | 
			
		||||
              anonymous: '0'
 | 
			
		||||
              admin: '0'
 | 
			
		||||
              root: '0'
 | 
			
		||||
              user: '0'
 | 
			
		||||
              editeur: '0'
 | 
			
		||||
            reduce: false
 | 
			
		||||
          is_grouped: false
 | 
			
		||||
          group_info:
 | 
			
		||||
            label: ''
 | 
			
		||||
            description: ''
 | 
			
		||||
            identifier: ''
 | 
			
		||||
            optional: true
 | 
			
		||||
            widget: select
 | 
			
		||||
            multiple: false
 | 
			
		||||
            remember: false
 | 
			
		||||
            default_group: All
 | 
			
		||||
            default_group_multiple: {  }
 | 
			
		||||
            group_items: {  }
 | 
			
		||||
          reduce_duplicates: false
 | 
			
		||||
          type: textfield
 | 
			
		||||
          limit: true
 | 
			
		||||
          vid: types_de_theme
 | 
			
		||||
          hierarchy: false
 | 
			
		||||
          error_message: true
 | 
			
		||||
          parent: 0
 | 
			
		||||
          level_labels: ''
 | 
			
		||||
          force_deepest: false
 | 
			
		||||
          save_lineage: false
 | 
			
		||||
          hierarchy_depth: 0
 | 
			
		||||
          required_depth: 0
 | 
			
		||||
          plugin_id: taxonomy_index_tid
 | 
			
		||||
      defaults:
 | 
			
		||||
        filters: false
 | 
			
		||||
        filter_groups: false
 | 
			
		||||
@@ -1017,6 +1092,69 @@ display:
 | 
			
		||||
          settings:
 | 
			
		||||
            link_to_entity: true
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        field_type_de_theme:
 | 
			
		||||
          id: field_type_de_theme
 | 
			
		||||
          table: node__field_type_de_theme
 | 
			
		||||
          field: field_type_de_theme
 | 
			
		||||
          relationship: none
 | 
			
		||||
          group_type: group
 | 
			
		||||
          admin_label: ''
 | 
			
		||||
          label: 'Type de theme'
 | 
			
		||||
          exclude: false
 | 
			
		||||
          alter:
 | 
			
		||||
            alter_text: false
 | 
			
		||||
            text: ''
 | 
			
		||||
            make_link: false
 | 
			
		||||
            path: ''
 | 
			
		||||
            absolute: false
 | 
			
		||||
            external: false
 | 
			
		||||
            replace_spaces: false
 | 
			
		||||
            path_case: none
 | 
			
		||||
            trim_whitespace: false
 | 
			
		||||
            alt: ''
 | 
			
		||||
            rel: ''
 | 
			
		||||
            link_class: ''
 | 
			
		||||
            prefix: ''
 | 
			
		||||
            suffix: ''
 | 
			
		||||
            target: ''
 | 
			
		||||
            nl2br: false
 | 
			
		||||
            max_length: 0
 | 
			
		||||
            word_boundary: true
 | 
			
		||||
            ellipsis: true
 | 
			
		||||
            more_link: false
 | 
			
		||||
            more_link_text: ''
 | 
			
		||||
            more_link_path: ''
 | 
			
		||||
            strip_tags: false
 | 
			
		||||
            trim: false
 | 
			
		||||
            preserve_tags: ''
 | 
			
		||||
            html: false
 | 
			
		||||
          element_type: ''
 | 
			
		||||
          element_class: ''
 | 
			
		||||
          element_label_type: ''
 | 
			
		||||
          element_label_class: ''
 | 
			
		||||
          element_label_colon: true
 | 
			
		||||
          element_wrapper_type: ''
 | 
			
		||||
          element_wrapper_class: ''
 | 
			
		||||
          element_default_classes: true
 | 
			
		||||
          empty: ''
 | 
			
		||||
          hide_empty: false
 | 
			
		||||
          empty_zero: false
 | 
			
		||||
          hide_alter_empty: true
 | 
			
		||||
          click_sort_column: target_id
 | 
			
		||||
          type: entity_reference_label
 | 
			
		||||
          settings:
 | 
			
		||||
            link: true
 | 
			
		||||
          group_column: target_id
 | 
			
		||||
          group_columns: {  }
 | 
			
		||||
          group_rows: true
 | 
			
		||||
          delta_limit: 0
 | 
			
		||||
          delta_offset: 0
 | 
			
		||||
          delta_reversed: false
 | 
			
		||||
          delta_first_last: false
 | 
			
		||||
          multi_type: separator
 | 
			
		||||
          separator: ', '
 | 
			
		||||
          field_api_classes: false
 | 
			
		||||
          plugin_id: field
 | 
			
		||||
        operations:
 | 
			
		||||
          id: operations
 | 
			
		||||
          table: node
 | 
			
		||||
@@ -1191,3 +1329,4 @@ display:
 | 
			
		||||
      tags:
 | 
			
		||||
        - 'config:field.storage.node.field_image'
 | 
			
		||||
        - 'config:field.storage.node.field_programme'
 | 
			
		||||
        - 'config:field.storage.node.field_type_de_theme'
 | 
			
		||||
 
 | 
			
		||||
@@ -50,7 +50,14 @@ process:
 | 
			
		||||
      alt: alt
 | 
			
		||||
      title: title
 | 
			
		||||
 | 
			
		||||
  field_type_de_theme:
 | 
			
		||||
    plugin: migration_lookup
 | 
			
		||||
    migration: d7_taxonomy_term_type_theme
 | 
			
		||||
    source: field_popsu_themtrans_type
 | 
			
		||||
    no_stub: true
 | 
			
		||||
 | 
			
		||||
migration_dependencies:
 | 
			
		||||
  required:
 | 
			
		||||
    - d7_allpublicfiles
 | 
			
		||||
    - d7_users
 | 
			
		||||
    - d7_taxonomy_term_type_theme
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,42 @@
 | 
			
		||||
id: d7_taxonomy_term_type_theme
 | 
			
		||||
label: Taxonomy terms Type de theme
 | 
			
		||||
migration_group: popsu
 | 
			
		||||
audit: true
 | 
			
		||||
migration_tags:
 | 
			
		||||
  - Drupal 7
 | 
			
		||||
  - Content
 | 
			
		||||
  - Popsu
 | 
			
		||||
deriver: Drupal\taxonomy\Plugin\migrate\D7TaxonomyTermDeriver
 | 
			
		||||
 | 
			
		||||
source:
 | 
			
		||||
  plugin: d7_taxoterm_typetheme
 | 
			
		||||
  bundle: popsu_themtrans
 | 
			
		||||
 | 
			
		||||
destination:
 | 
			
		||||
  plugin: entity:taxonomy_term
 | 
			
		||||
 | 
			
		||||
process:
 | 
			
		||||
  # If you are using this file to build a custom migration consider removing
 | 
			
		||||
  # the tid field to allow incremental migrations.
 | 
			
		||||
  # tid: tid
 | 
			
		||||
  vid:
 | 
			
		||||
    plugin: default_value
 | 
			
		||||
    default_value: types_de_theme
 | 
			
		||||
  name: name
 | 
			
		||||
  'description/value': description
 | 
			
		||||
  'description/format': format
 | 
			
		||||
  weight: weight
 | 
			
		||||
  # Only attempt to stub real (non-zero) parents.
 | 
			
		||||
  parent_id:
 | 
			
		||||
    -
 | 
			
		||||
      plugin: skip_on_empty
 | 
			
		||||
      method: process
 | 
			
		||||
      source: parent
 | 
			
		||||
    -
 | 
			
		||||
      plugin: migration_lookup
 | 
			
		||||
      migration: d7_taxonomy_term_type_theme
 | 
			
		||||
  parent:
 | 
			
		||||
    plugin: default_value
 | 
			
		||||
    default_value: 0
 | 
			
		||||
    source: '@parent_id'
 | 
			
		||||
  changed: timestamp
 | 
			
		||||
@@ -161,7 +161,7 @@ class D7NodeTheme extends FieldableEntity {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ($field_images) {
 | 
			
		||||
      Drush::output()->writeln(dump($field_images));
 | 
			
		||||
      // Drush::output()->writeln(dump($field_images));
 | 
			
		||||
      $row->setSourceProperty('images', $field_images);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,95 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\popsu_migrate\Plugin\migrate\source;
 | 
			
		||||
 | 
			
		||||
use Drupal\migrate\Row;
 | 
			
		||||
use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Taxonomy term source from database.
 | 
			
		||||
 *
 | 
			
		||||
 * @MigrateSource(
 | 
			
		||||
 *   id = "d7_taxoterm_typetheme",
 | 
			
		||||
 *   source_module = "taxonomy"
 | 
			
		||||
 * )
 | 
			
		||||
 */
 | 
			
		||||
class D7TaxotermTypetheme extends FieldableEntity {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function query() {
 | 
			
		||||
    $query = $this->select('taxonomy_term_data', 'td')
 | 
			
		||||
      ->fields('td')
 | 
			
		||||
      ->orderBy('tid');
 | 
			
		||||
 | 
			
		||||
    $query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid');
 | 
			
		||||
    $query->addField('tv', 'machine_name');
 | 
			
		||||
 | 
			
		||||
    if (isset($this->configuration['bundle'])) {
 | 
			
		||||
      $query->condition('tv.machine_name', (array) $this->configuration['bundle'], 'IN');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return $query;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function fields() {
 | 
			
		||||
    $fields = [
 | 
			
		||||
      'tid' => $this->t('The term ID.'),
 | 
			
		||||
      'vid' => $this->t('Existing term VID'),
 | 
			
		||||
      'machine_name' => $this->t('Vocabulary machine name'),
 | 
			
		||||
      'name' => $this->t('The name of the term.'),
 | 
			
		||||
      'description' => $this->t('The term description.'),
 | 
			
		||||
      'weight' => $this->t('Weight'),
 | 
			
		||||
      'parent' => $this->t("The Drupal term IDs of the term's parents."),
 | 
			
		||||
      'format' => $this->t("Format of the term description."),
 | 
			
		||||
      'synonyms' => $this->t("Term's Synonyms (field : synonyms_synonym)"),
 | 
			
		||||
      'displayed_on_advanced_search' => $this->t("field_used_on_advanced_search"),
 | 
			
		||||
      'revision_id' => $this->t('Revision ID'),
 | 
			
		||||
      'language' => $this->t('Term translation language'),
 | 
			
		||||
      'source' => $this->t('Term translation source language'),
 | 
			
		||||
    ];
 | 
			
		||||
    return $fields;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function prepareRow(Row $row) {
 | 
			
		||||
    $language = $row->getSourceProperty('language');
 | 
			
		||||
    // drush_print('-- '.$language."\t".$row->getSourceProperty('tid')."\t".$row->getSourceProperty('name'));
 | 
			
		||||
 | 
			
		||||
    $tid = $row->getSourceProperty('tid');
 | 
			
		||||
    // vocabulary machine name
 | 
			
		||||
    $machine_name = $row->getSourceProperty('machine_name');
 | 
			
		||||
    $revid = $row->getSourceProperty('revision_id');
 | 
			
		||||
 | 
			
		||||
    // Get Field API field values.
 | 
			
		||||
    foreach ($this->getFields('taxonomy_term', $machine_name) as $field_name => $field) {
 | 
			
		||||
      $row->setSourceProperty($field_name, $this->getFieldValues('taxonomy_term', $field_name, $tid, $revid, NULL));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Find parents for this row.
 | 
			
		||||
    $parents = $this->select('taxonomy_term_hierarchy', 'th')
 | 
			
		||||
      ->fields('th', ['parent', 'tid'])
 | 
			
		||||
      ->condition('tid', $row->getSourceProperty('tid'))
 | 
			
		||||
      ->execute()
 | 
			
		||||
      ->fetchCol();
 | 
			
		||||
    $row->setSourceProperty('parent', $parents);
 | 
			
		||||
 | 
			
		||||
    return parent::prepareRow($row);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function getIds() {
 | 
			
		||||
    $ids['tid']['type'] = 'integer';
 | 
			
		||||
    return $ids;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user