Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ web/sites/default/settings.local.php
.vagrant
Vagrantfile.local
local.config.yml

# Ignore vim
*.swp
7 changes: 7 additions & 0 deletions config/sync/core.entity_form_display.node.people.default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ langcode: en
status: true
dependencies:
config:
- field.field.node.people.comment
- field.field.node.people.field_country
- field.field.node.people.field_dob
- field.field.node.people.field_email
Expand All @@ -11,13 +12,19 @@ dependencies:
- field.field.node.people.field_last_name
- node.type.people
module:
- comment
- datetime
- path
id: node.people.default
targetEntityType: node
bundle: people
mode: default
content:
comment:
weight: 37
settings: { }
third_party_settings: { }
type: comment_default
created:
type: datetime_timestamp
weight: 10
Expand Down
11 changes: 11 additions & 0 deletions config/sync/core.entity_view_display.node.people.default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ langcode: en
status: true
dependencies:
config:
- core.entity_view_display.comment.comment.default
- field.field.node.people.comment
- field.field.node.people.field_country
- field.field.node.people.field_dob
- field.field.node.people.field_email
Expand All @@ -11,13 +13,22 @@ dependencies:
- field.field.node.people.field_last_name
- node.type.people
module:
- comment
- datetime
- user
id: node.people.default
targetEntityType: node
bundle: people
mode: default
content:
comment:
weight: 107
label: above
settings:
view_mode: default
pager_id: 0
third_party_settings: { }
type: comment_default
field_country:
weight: 104
label: above
Expand Down
33 changes: 33 additions & 0 deletions config/sync/field.field.node.people.comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
uuid: 387af81b-94ba-4f20-a7ca-4053b6e7746a
langcode: en
status: true
dependencies:
config:
- field.storage.node.comment
- node.type.people
module:
- comment
id: node.people.comment
field_name: comment
entity_type: node
bundle: people
label: Comments
description: ''
required: false
translatable: true
default_value:
-
status: 2
cid: 0
last_comment_timestamp: 0
last_comment_name: null
last_comment_uid: 0
comment_count: 0
default_value_callback: ''
settings:
default_mode: 1
per_page: 50
anonymous: 0
form_location: true
preview: 1
field_type: comment
6 changes: 6 additions & 0 deletions web/modules/custom/custom_migrate/artifacts/comments.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
id,person_id,cid_parent,subject,body,name,mail,aid
1,2,,"foo","foo",,,1
2,2,1,"bar","bar",,,1
3,2,2,"baz","baz",,,1
4,3,,"qux","qux",,,1
5,3,4,"buzz","buzz",,,1
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
langcode: en
status: true
dependencies:
enforced:
# List here the name of the module that provided this migration if you want
# this config to be removed when that module is uninstalled.
module:
- custom_migrate
migration_dependencies:
required:
- migrate_csv
# The source data is in CSV files, so we use the 'csv' source plugin.
id: migrate_csv_comments
label: CSV file migration of comments
migration_tags:
- CSV
source:
plugin: csv
# Full path to the file.
path: /artifacts/comments.csv
# The number of rows at the beginning which are not data.
header_row_count: 1
# These are the field names from the source file representing the key
# uniquely identifying each game - they will be stored in the migration
# map table as columns sourceid1, sourceid2, and sourceid3.
keys:
- id
# Here we identify the columns of interest in the source file. Each numeric
# key is the 0-based index of the column. For each column, the key below
# (e.g., "start_date") is the field name assigned to the data on import, to
# be used in field mappings below. The value is a user-friendly string for
# display by the migration UI.
column_names:
# So, here we're saying that the first field (index 0) on each line will
# be stored in the start_date field in the Row object during migration, and
# that name can be used to map the value below. "Date of game" will appear
# in the UI to describe this field.
0:
id: Comment ID
1:
person_id: Person ID
2:
cid_parent: Parent Comment ID
3:
subject: Subject
4:
body: Body
5:
name: Name
6:
mail: Mail
7:
aid: Author ID
process:
pid:
plugin: migration
migration: migrate_csv_comments
source: cid_parent
entity_id:
plugin: migration
migration: migrate_csv
source: person_id
entity_type:
plugin: default_value
default_value: node
field_name:
plugin: default_value
default_value: comment
subject: subject
uid:
plugin: default_value
default_value: 1
name: name
mail: mail
status:
plugin: default_value
default_value: 1
'comment_body/value': body
destination:
# Here we're saying that each row of data (line from the CSV file) will be
# used to create a comment entity.
plugin: entity:comment
1 change: 1 addition & 0 deletions web/modules/custom/custom_migrate/custom_migrate.module
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ function custom_migrate_help($route_name, RouteMatchInterface $route_match) {
*/
function custom_migrate_migration_plugins_alter(&$definitions) {
$definitions['migrate_csv']['source']['path'] = drupal_get_path('module', 'custom_migrate') . $definitions['migrate_csv']['source']['path'];
$definitions['migrate_csv_comments']['source']['path'] = drupal_get_path('module', 'custom_migrate') . $definitions['migrate_csv_comments']['source']['path'];
}