Merge branch 'master' into front

This commit is contained in:
Bachir Soussi Chiadmi 2019-05-01 19:33:55 +02:00
commit 5d93b34def
49 changed files with 765 additions and 453 deletions

View File

@ -33,6 +33,7 @@
"drupal/console": "^1.0.2",
"drupal/core": "^8.6.0",
"drupal/entity_clone": "^1.0",
"drupal/genpass": "1.x-dev",
"drupal/jsonapi": "^2.4",
"drupal/login_history": "1.x-dev",
"drupal/mailgun": "1.x-dev",
@ -45,6 +46,7 @@
"drupal/simplenews": "1.x-dev",
"drupal/telephone_formatter": "^1.0@beta",
"drupal/telephone_validation": "^2.1",
"drupal/ultimate_cron": "2.x-dev",
"drupal/views_conditional": "1.x-dev",
"drush/drush": "^9.0.0",
"vlucas/phpdotenv": "^2.4",
@ -112,9 +114,6 @@
"drupal/migrate_tools": {
"The --limit option does not accept a value.": "https://www.drupal.org/files/issues/2019-02-05/migrate-tools_fix-drush-options_3024399-23.patch"
},
"drupal/simplenews": {
"simplenew migration compatibility https://www.drupal.org/project/simplenews/issues/2954077": "https://www.drupal.org/files/issues/2019-03-15/simplenews.migrate-2954077-32.patch"
},
"drupal/email_registration": {
"allow email login through REST https://www.drupal.org/project/email_registration/issues/2856542": "https://www.drupal.org/files/issues/allow_authentication-2856542-3.patch"
}

785
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +0,0 @@
page_alter: false
raw_names: false
error_handlers:
1: 1
rebuild_theme: true
debug_mail_file_format: '%to-%subject-%datetime.mail.txt'
debug_mail_directory: 'temporary://devel-mails'
devel_dumper: default
_core:
default_config_hash: 8SYa5OOpQGdg4wnttb0LFNuG6GmivsS2qNv9sTH9gDI

View File

@ -1,6 +1,6 @@
uuid: 6844a7d0-31bc-4cea-a72b-c0bb4c29b530
langcode: en
status: true
status: false
dependencies:
module:
- system

View File

@ -1,3 +1,3 @@
default_store: f62391e2-4c98-4fd8-8f67-6c50d6ed10ef
default_store: bb23cf22-6a06-4f8d-88fc-0998f15ff2d0
_core:
default_config_hash: B9ZFGR76POyzj9f3Sh66F346_Jp-wnnUc78Hk3Q-60o

View File

@ -27,6 +27,13 @@ content:
settings: { }
third_party_settings: { }
region: content
cart:
type: boolean_checkbox
settings:
display_label: true
weight: 20
region: content
third_party_settings: { }
order_items:
type: inline_entity_form_complex
weight: 1

View File

@ -70,6 +70,11 @@ content:
placeholder: ''
third_party_settings: { }
region: content
translation:
weight: 10
settings: { }
third_party_settings: { }
region: content
uid:
type: entity_reference_autocomplete
weight: 4

View File

@ -68,6 +68,11 @@ content:
size: 60
placeholder: ''
third_party_settings: { }
translation:
weight: 10
settings: { }
third_party_settings: { }
region: content
uid:
type: entity_reference_autocomplete
weight: 5
@ -77,4 +82,5 @@ content:
size: 60
placeholder: ''
third_party_settings: { }
hidden: { }
hidden:
variations: true

View File

@ -45,7 +45,6 @@ third_party_settings:
- group_files
- group_links
- group_samples_showroom
- group_internal
parent_name: ''
weight: 0
format_type: tabs
@ -159,15 +158,16 @@ third_party_settings:
- field_memo
- field_workflow
- field_migration
parent_name: group_htabs
weight: 15
parent_name: ''
weight: 1
format_type: tab
format_settings:
id: ''
classes: ''
formatter: closed
label: Internal
formatter: open
description: ''
required_fields: true
id: ''
classes: ''
label: Internal
id: node.materiau.default
targetEntityType: node
@ -307,7 +307,7 @@ content:
third_party_settings: { }
path:
type: path
weight: 1
weight: 2
region: content
settings: { }
third_party_settings: { }
@ -325,7 +325,7 @@ content:
settings: { }
third_party_settings: { }
url_redirects:
weight: 2
weight: 3
region: content
settings: { }
third_party_settings: { }

View File

@ -30,7 +30,6 @@ third_party_settings:
- group_infos
- group_contents
- group_attachments
- group_internal
parent_name: ''
weight: 1
format_type: tabs
@ -79,15 +78,16 @@ third_party_settings:
- field_memo
- langcode
- translation
parent_name: group_tabs
weight: 15
parent_name: ''
weight: 2
format_type: tab
format_settings:
id: ''
classes: ''
formatter: closed
label: Internal
formatter: open
description: ''
required_fields: true
id: ''
classes: ''
label: Internal
group_attachments:
children:
@ -160,8 +160,7 @@ content:
region: content
field_public_address:
weight: 17
settings:
default_country: null
settings: { }
third_party_settings: { }
type: address_default
region: content

View File

@ -74,10 +74,10 @@ content:
settings: { }
third_party_settings: { }
simplenews:
weight: 7
region: content
weight: 5
settings: { }
third_party_settings: { }
region: content
hidden:
commerce_remote_id: true
langcode: true

View File

@ -36,7 +36,12 @@ content:
third_party_settings: { }
region: content
hidden:
billing_schedule: true
commerce_variation_cart_form: true
langcode: true
license_expiration: true
license_type: true
price: true
sku: true
subscription_type: true
title: true

View File

@ -43,6 +43,11 @@ content:
third_party_settings: { }
region: content
hidden:
billing_schedule: true
commerce_variation_cart_form: true
langcode: true
license_expiration: true
license_type: true
price: true
sku: true
subscription_type: true

View File

@ -26,3 +26,5 @@ hidden:
langcode: true
mail: true
name: true
prices_include_tax: true
tax_registrations: true

View File

@ -39,6 +39,7 @@ content:
region: content
hidden:
field_date: true
field_linked_materials: true
field_memo: true
field_migration: true
field_showroom: true

View File

@ -67,6 +67,7 @@ module:
file: 0
filter: 0
filter_perms: 0
genpass: 0
help: 0
honeypot: 0
image: 0

View File

@ -0,0 +1,7 @@
genpass_length: 12
genpass_algorithm: user
genpass_entropy: 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789!#$%&*+-.?@^_'
genpass_mode: 1
genpass_display: 3
_core:
default_config_hash: HNSTwPQM5lvXFeH4cVlcB2gZFJ5S--Nbmfj7651HK24

View File

@ -3,8 +3,10 @@ default_config:
page_breaker:
pages:
prefix_label: Page
first: «
previous:
next:
last: »
page_current_title: 'Page courante'
page_title: 'Aller à la page @number'
first_title: 'Aller à la première page'
@ -19,12 +21,16 @@ default_config:
last_reader: 'Dernière page'
items:
prefix_label: Élément
first: «
previous:
next:
last: »
page_reader: Élément
first_reader: 'Premier élément'
item_ranges:
prefix_label: Éléments
first: «
previous:
next:
last: »
page_reader: Éléments

View File

@ -1,8 +1,10 @@
default_config:
tags:
pages:
first: «
previous:
next:
last: »
first_title: 'Aller à la première page'
previous_title: 'Aller à la page précédente'
next_title: 'Aller à la page suivante'
@ -12,9 +14,13 @@ default_config:
next_reader: 'Page suivante'
last_reader: 'Dernière page'
items:
first: «
previous:
next:
last: »
first_reader: 'Premier élément'
item_ranges:
first: «
previous:
next:
last: »

View File

@ -2,8 +2,10 @@ default_config:
tags:
pages:
prefix_label: Page
first: «
previous:
next:
last: »
page_current_title: 'Page courante'
first_title: 'Aller à la première page'
previous_title: 'Aller à la page précédente'
@ -16,6 +18,8 @@ default_config:
last_reader: 'Dernière page'
items:
prefix_label: Élément
first: «
previous:
next:
last: »
first_reader: 'Premier élément'

View File

@ -3,8 +3,10 @@ default_config:
page_breaker:
pages:
prefix_label: Page
first: «
previous:
next:
last: »
page_current_title: 'Page courante'
page_title: 'Aller à la page @number'
first_title: 'Aller à la première page'
@ -19,12 +21,16 @@ default_config:
last_reader: 'Dernière page'
items:
prefix_label: Élément
first: «
previous:
next:
last: »
page_reader: Élément
first_reader: 'Premier élément'
item_ranges:
prefix_label: Éléments
first: «
previous:
next:
last: »
page_reader: Éléments

View File

@ -2,8 +2,10 @@ default_config:
tags:
pages:
prefix_label: Page
first: «
previous:
next:
last: »
page_current_title: 'Page courante'
page_title: 'Aller à la page @number'
first_title: 'Aller à la première page'
@ -18,12 +20,16 @@ default_config:
last_reader: 'Dernière page'
items:
prefix_label: Élément
first: «
previous:
next:
last: »
page_reader: Élément
first_reader: 'Premier élément'
item_ranges:
prefix_label: Éléments
first: «
previous:
next:
last: »
page_reader: Éléments

View File

@ -2,8 +2,10 @@ default_config:
tags:
pages:
prefix_label: Page
first: «
previous:
next:
last: »
page_current_title: 'Page courante'
first_title: 'Aller à la première page'
previous_title: 'Aller à la page précédente'
@ -16,10 +18,14 @@ default_config:
last_reader: 'Dernière page'
items:
prefix_label: Élément
first: «
previous:
next:
last: »
first_reader: 'Premier élément'
item_ranges:
prefix_label: Éléments
first: «
previous:
next:
last: »

View File

@ -1,4 +1,4 @@
uuid: 0760f01a-10ad-4876-8b7c-fc365bb7d604
uuid: 79ab8656-5caa-4963-8a96-b8e99a95734b
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: 5e293a2e-4f35-4d00-9c37-d7e10a818d52
uuid: 6699fa94-779c-4ec6-80e7-529a15e8a649
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: 04726237-a1a9-4829-a854-a545cded4647
uuid: 2ff8e8e0-ca3d-47d6-875f-f8de1e735f19
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: bb67ccda-12a5-4ae9-806f-1f5b61094fc4
uuid: fe4c9750-5837-4072-9c3f-7462e8edd77c
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: 7db5c1c8-0479-40a9-a581-dbf82068fb08
uuid: 1cc85278-4253-4ee4-abe9-bdbfdbcd4fd1
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: 26d4512d-f71d-4df2-8785-b0c339cbfd13
uuid: d871f284-27e4-4ace-977b-d036fbc3519c
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: 15c8fbd5-0cfd-4209-8514-d95334c3ed60
uuid: 1700dfa0-73b4-44a1-a62d-a93055ba700d
langcode: en
status: true
dependencies: { }

View File

@ -1,9 +1,9 @@
uuid: 9fd16d6a-6740-47f9-9f3a-dd63cd8aa468
uuid: 8465fcbe-2003-4af4-ac5b-906f1b85dda7
langcode: en
status: true
dependencies: { }
_core:
default_config_hash: Y7surKNH2d9UWee4zzr6yzSyfIruwBMTs1xSoL_ShG4
default_config_hash: KD8aokrh9C4c7Cnr91IkjxeMimTrOAqjLSWjRACToJ8
id: d7_taxonomy_term_company
class: null
field_plugin_method: null
@ -30,7 +30,7 @@ process:
source: parent
-
plugin: migration_lookup
migration: d7_taxonomy_term_companie
migration: d7_taxonomy_term_company
parent:
plugin: default_value
default_value: 0

View File

@ -1,4 +1,4 @@
uuid: 6e9d0176-5410-4dcd-b620-875eab1348c8
uuid: 82fb4ac1-4ba1-4fe4-9910-1dcb12eae60c
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: 8d668861-4599-44b9-b17b-c35120a4d23a
uuid: a314593d-a9b5-4a75-95cf-da2a0b972b72
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: 4156ec2e-7374-4270-aea3-40c14ee20790
uuid: 69374e74-992d-4754-a950-8797b63a590d
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: 9b453f7f-4fc4-4826-bac6-6f49b734425e
uuid: 44d6af6e-b0be-49e6-8833-351d39efcc9b
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: 74f03ea2-db39-4cb2-87e1-e65fa24040dd
uuid: 9180eced-8d25-44f9-8c93-b8c6b00e656e
langcode: en
status: true
dependencies: { }

View File

@ -1,4 +1,4 @@
uuid: f3576dd2-cf66-4cfc-b41e-45d4855ac987
uuid: 2612da83-201b-49c2-aa68-a0503029ab47
langcode: en
status: true
dependencies:

View File

@ -1,4 +1,4 @@
uuid: a76e06da-26f4-44b5-90d8-22a080c05bef
uuid: 71aada73-563b-44cd-b369-249fe043905e
langcode: en
status: true
dependencies:

View File

@ -1,11 +1,11 @@
uuid: ec3736c2-9d18-46ee-bda0-e0b1f350b69e
uuid: 0e8915f4-3471-4dbf-8d6a-767622125b26
langcode: en
status: true
dependencies: { }
_core:
default_config_hash: A9EdRJlr8o5qMY-JbJU_n7Cv0Java4lZouu__eONDWM
default_config_hash: MSrCVV09c4n2q36chsUNrsaE87aqSrk3FfoG7QBzuxg
id: d7_users
class: Drupal\user\Plugin\migrate\User
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags:
@ -15,7 +15,7 @@ migration_tags:
migration_group: d7_materio
label: 'User accounts'
source:
plugin: d7_user
plugin: d7_users
process:
name: name
pass: pass
@ -68,21 +68,15 @@ process:
11: alpha_testeur
12: translator
13: admin_showroom
user_picture:
-
plugin: default_value
source: picture
default_value: null
-
plugin: migration_lookup
migration: d7_file
field_company:
plugin: migration_lookup
migration: d7_taxonomy_term_company
source: field_company
no_stub: true
field_showroom:
plugin: migration_lookup
migration: d7_taxonomy_term_showroom
no_stub: true
source: field_showroom
field_memo: field_memo
destination:
@ -90,3 +84,5 @@ destination:
migration_dependencies:
required:
- d7_allpublicfiles
- d7_taxonomy_term_showroom
- d7_taxonomy_term_company

View File

@ -1,4 +1,4 @@
uuid: 400201fd-9145-4ea2-bace-9325c7ef59f5
uuid: 75218419-b6ef-4f16-9ea9-bc7a04727826
langcode: en
status: true
dependencies:

View File

@ -12,3 +12,4 @@ default_langcode: en
_core:
default_config_hash: KpKfgMpPrABs7m0Uqd8VFuYXns2cRXsuYy0QL4SRE14
uuid: 9171a304-01d9-44e1-a59c-d36d77ac6bb0
mail_notification: ''

View File

@ -1,29 +1,29 @@
cancel_confirm:
body: "[user:display-name],\n\nA request to cancel your account has been made at [site:name].\n\nYou may now cancel your account on [site:url-brief] by clicking this link or copying and pasting it into your browser:\n\n[user:cancel-url]\n\nNOTE: The cancellation of your account is not reversible.\n\nThis link expires in one day and nothing will happen if it is not used.\n\n-- [site:name] team"
body: "[user:display-name],\r\n\r\nA request to cancel your account has been made at [site:name].\r\n\r\nYou may now cancel your account on [site:url-brief] by clicking this link or copying and pasting it into your browser:\r\n\r\n[user:cancel-url]\r\n\r\nNOTE: The cancellation of your account is not reversible.\r\n\r\nThis link expires in one day and nothing will happen if it is not used.\r\n\r\n-- [site:name] team"
subject: 'Account cancellation request for [user:display-name] at [site:name]'
password_reset:
body: "[user:display-name],\n\nA request to reset the password for your account has been made at [site:name].\n\nYou may now log in by clicking this link or copying and pasting it into your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password. It expires after one day and nothing will happen if it's not used.\n\n-- [site:name] team"
body: "[user:display-name],\r\n\r\nA request to reset the password for your account has been made at [site:name].\r\n\r\nYou may now log in by clicking this link or copying and pasting it into your browser:\r\n\r\n[user:one-time-login-url]\r\n\r\nThis link can only be used once to log in and will lead you to a page where you can set your password. It expires after one day and nothing will happen if it's not used.\r\n\r\n-- [site:name] team"
subject: 'Replacement login information for [user:display-name] at [site:name]'
register_admin_created:
body: "[user:display-name],\n\nA site administrator at [site:name] has created an account for you. You may now log in by clicking this link or copying and pasting it into your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:name]\npassword: Your password\n\n-- [site:name] team"
body: "[user:display-name],\r\n\r\nA site administrator at [site:name] has created an account for you. You may now log in by clicking this link or copying and pasting it into your browser:\r\n\r\n[user:one-time-login-url]\r\n\r\nThis link can only be used once to log in and will lead you to a page where you can set your password.\r\n\r\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\r\n\r\nusername: [user:name]\r\npassword: Your password\r\n\r\n-- [site:name] team"
subject: 'An administrator created an account for you at [site:name]'
register_no_approval_required:
body: "[user:display-name],\n\nThank you for registering at [site:name]. You may now log in by clicking this link or copying and pasting it into your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:name]\npassword: Your password\n\n-- [site:name] team"
body: "[user:display-name],\r\n\r\nThank you for registering at [site:name]. You may now log in by clicking this link or copying and pasting it into your browser:\r\n\r\n[user:one-time-login-url]\r\n\r\nThis link can only be used once to log in and will lead you to a page where you can set your password.\r\n\r\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\r\n\r\nusername: [user:name]\r\npassword: Your password\r\n\r\n-- [site:name] team"
subject: 'Account details for [user:display-name] at [site:name]'
register_pending_approval:
body: "[user:display-name],\n\nThank you for registering at [site:name]. Your application for an account is currently pending approval. Once it has been approved, you will receive another email containing information about how to log in, set your password, and other details.\n\n-- [site:name] team"
body: "[user:display-name],\r\n\r\nThank you for registering at [site:name]. Your application for an account is currently pending approval. Once it has been approved, you will receive another email containing information about how to log in, set your password, and other details.\r\n\r\n-- [site:name] team"
subject: 'Account details for [user:display-name] at [site:name] (pending admin approval)'
register_pending_approval_admin:
body: "[user:display-name] has applied for an account.\n\n[user:edit-url]"
body: "[user:display-name] has applied for an account.\r\n\r\n[user:edit-url]"
subject: 'Account details for [user:display-name] at [site:name] (pending admin approval)'
status_activated:
body: "[user:display-name],\n\nYour account at [site:name] has been activated.\n\nYou may now log in by clicking this link or copying and pasting it into your browser:\n\n[user:one-time-login-url]\n\nThis link can only be used once to log in and will lead you to a page where you can set your password.\n\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\n\nusername: [user:account-name]\npassword: Your password\n\n-- [site:name] team"
body: "[user:display-name],\r\n\r\nYour account at [site:name] has been activated.\r\n\r\nYou may now log in by clicking this link or copying and pasting it into your browser:\r\n\r\n[user:one-time-login-url]\r\n\r\nThis link can only be used once to log in and will lead you to a page where you can set your password.\r\n\r\nAfter setting your password, you will be able to log in at [site:login-url] in the future using:\r\n\r\nusername: [user:account-name]\r\npassword: Your password\r\n\r\n-- [site:name] team"
subject: 'Account details for [user:display-name] at [site:name] (approved)'
status_blocked:
body: "[user:display-name],\n\nYour account on [site:name] has been blocked.\n\n-- [site:name] team"
body: "[user:display-name],\r\n\r\nYour account on [site:name] has been blocked.\r\n\r\n-- [site:name] team"
subject: 'Account details for [user:display-name] at [site:name] (blocked)'
status_canceled:
body: "[user:display-name],\n\nYour account on [site:name] has been canceled.\n\n-- [site:name] team"
body: "[user:display-name],\r\n\r\nYour account on [site:name] has been canceled.\r\n\r\n-- [site:name] team"
subject: 'Account details for [user:display-name] at [site:name] (canceled)'
langcode: en
_core:

View File

@ -3595,7 +3595,7 @@ display:
responsive: ''
changed:
sortable: true
default_sort_order: asc
default_sort_order: desc
align: ''
separator: ''
empty_column: false
@ -3607,7 +3607,7 @@ display:
separator: ''
empty_column: false
responsive: ''
default: '-1'
default: changed
empty_table: false
row:
type: fields

View File

@ -12,15 +12,6 @@ echo "Migrating Files"
drush mim d7_allpublicfiles --feedback="1000"
sleep 5
echo " "
echo "Migrating Users"
drush mim d7_users --feedback="1000"
echo " "
drush mim d7_user_profile --feedback="1000"
echo " "
drush mim d7_uc_roles_license --update --feedback="200"
sleep 5
echo " "
echo "Migrating Taxonomy"
echo "Migrating thesaurus"
@ -46,6 +37,15 @@ echo "Migrating showroom"
drush mim d7_taxonomy_term_showroom --update --feedback="100"
sleep 5
echo " "
echo "Migrating Users"
drush mim d7_users --update --feedback="1000"
echo " "
drush mim d7_user_profile --feedback="1000"
echo " "
drush mim d7_uc_roles_license --update --feedback="200"
sleep 5
echo " "
echo "Migrating Nodes"
echo "Migrating Materials"

View File

@ -32,7 +32,7 @@ process:
source: parent
-
plugin: migration_lookup
migration: d7_taxonomy_term_companie
migration: d7_taxonomy_term_company
parent:
plugin: default_value
default_value: 0

View File

@ -6,19 +6,14 @@ migration_tags:
- Drupal 7
- Content
- Materio
class: Drupal\user\Plugin\migrate\User
source:
plugin: d7_user
plugin: d7_users
destination:
plugin: entity:user
process:
# If you are using this file to build a custom migration consider removing
# the uid field to allow incremental migrations.
# uid: uid
name: name
pass: pass
mail:
@ -53,10 +48,6 @@ process:
source: language
fallback_to_site_default: true
init: init
# roles:
# plugin: migration_lookup
# migration: d7_user_role
# source: roles
roles:
plugin: static_map
source: roles
@ -76,32 +67,48 @@ process:
12: "translator"
13: "admin_showroom"
user_picture:
-
plugin: default_value
source: picture
default_value: null
-
plugin: migration_lookup
migration: d7_file
# TODO : a vérifier
# jai fait un test de recherche sur ce tableau user (recherche par email "@materio.com"), les réponses sont pour linstant aberrantes (kevin travaille par exemple chez Onip Peinture)
field_company:
plugin: migration_lookup
migration: d7_taxonomy_term_company
source: field_company
no_stub: true
# field_company:
# -
# plugin: sub_process
# source: field_company
# process:
# target_id:
# plugin: migration_lookup
# migration: d7_taxonomy_term_company
# source: tid
# no_stub: true
# field_company:
# plugin: default_value
# default_value: 2673
field_showroom:
plugin: migration_lookup
migration: d7_taxonomy_term_showroom
no_stub: true
source: field_showroom
field_memo: field_memo
# user_picture:
# -
# plugin: default_value
# source: picture
# default_value: null
# -
# plugin: migration_lookup
# migration: d7_file
# no_stub: true
migration_dependencies:
required:
- d7_allpublicfiles
- d7_taxonomy_term_showroom
- d7_taxonomy_term_company
# optional:
# - d7_field_instance
# - d7_file

View File

@ -0,0 +1,152 @@
<?php
namespace Drupal\materio_migrate\Plugin\migrate\source;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
/**
* Drupal 7 user source from database.
*
* @MigrateSource(
* id = "d7_users",
* source_module = "user"
* )
*/
class D7Users extends FieldableEntity {
/**
* {@inheritdoc}
*/
public function query() {
return $this->select('users', 'u')
->fields('u')
->condition('u.uid', 0, '>');
}
/**
* {@inheritdoc}
*/
public function fields() {
$fields = [
'uid' => $this->t('User ID'),
'name' => $this->t('Username'),
'pass' => $this->t('Password'),
'mail' => $this->t('Email address'),
'signature' => $this->t('Signature'),
'signature_format' => $this->t('Signature format'),
'created' => $this->t('Registered timestamp'),
'access' => $this->t('Last access timestamp'),
'login' => $this->t('Last login timestamp'),
'status' => $this->t('Status'),
'timezone' => $this->t('Timezone'),
'language' => $this->t('Language'),
'picture' => $this->t('Picture'),
'init' => $this->t('Init'),
'data' => $this->t('User data'),
'roles' => $this->t('Roles'),
];
// Profile fields.
if ($this->moduleExists('profile')) {
$fields += $this->select('profile_fields', 'pf')
->fields('pf', ['name', 'title'])
->execute()
->fetchAllKeyed();
}
return $fields;
}
/**
* {@inheritdoc}
*/
public function prepareRow(Row $row) {
$uid = $row->getSourceProperty('uid');
$roles = $this->select('users_roles', 'ur')
->fields('ur', ['rid'])
->condition('ur.uid', $uid)
->execute()
->fetchCol();
$row->setSourceProperty('roles', $roles);
$row->setSourceProperty('data', unserialize($row->getSourceProperty('data')));
// If this entity was translated using Entity Translation, we need to get
// its source language to get the field values in the right language.
// The translations will be migrated by the d7_user_entity_translation
// migration.
$entity_translatable = $this->isEntityTranslatable('user');
$source_language = $this->getEntityTranslationSourceLanguage('user', $uid);
$language = $entity_translatable && $source_language ? $source_language : $row->getSourceProperty('language');
$row->setSourceProperty('entity_language', $language);
// Get Field API field values.
foreach ($this->getFields('user') as $field_name => $field) {
// Ensure we're using the right language if the entity and the field are
// translatable.
$field_language = $entity_translatable && $field['translatable'] ? $language : NULL;
$field_values = $this->getFieldValues('user', $field_name, $uid, NULL, $field_language);
// $field_values = [];
// if ($field_name === 'field_company') {
// // print($uid . " ---\n");
// // print_r($tmp_field_values);
// // fix the taxo tid as tode module replace it by node nid
// // get the real tode tid
// foreach ($tmp_field_values as $key => $value) {
// $tode_tid = $this->select('field_data_field_tode_company', 'tode')
// ->condition('entity_type', 'node')
// ->condition('entity_id', $value['tid'])
// ->fields('tode', ['field_tode_company_tid'])
// ->execute()->fetchField();
// $field_values[] = array('tid'=>$tode_tid);
// }
// // print_r($field_values);
// $row->setSourceProperty('companies', $field_values);
// }
$row->setSourceProperty($field_name, $field_values);
}
// Get profile field values. This code is lifted directly from the D6
// ProfileFieldValues plugin.
if ($this->getDatabase()->schema()->tableExists('profile_value')) {
$query = $this->select('profile_value', 'pv')
->fields('pv', ['fid', 'value']);
$query->leftJoin('profile_field', 'pf', 'pf.fid=pv.fid');
$query->fields('pf', ['name', 'type']);
$query->condition('uid', $row->getSourceProperty('uid'));
$results = $query->execute();
foreach ($results as $profile_value) {
if ($profile_value['type'] == 'date') {
$date = unserialize($profile_value['value']);
$date = date('Y-m-d', mktime(0, 0, 0, $date['month'], $date['day'], $date['year']));
$row->setSourceProperty($profile_value['name'], ['value' => $date]);
}
elseif ($profile_value['type'] == 'list') {
// Explode by newline and comma.
$row->setSourceProperty($profile_value['name'], preg_split("/[\r\n,]+/", $profile_value['value']));
}
else {
$row->setSourceProperty($profile_value['name'], [$profile_value['value']]);
}
}
}
return parent::prepareRow($row);
}
/**
* {@inheritdoc}
*/
public function getIds() {
return [
'uid' => [
'type' => 'integer',
'alias' => 'u',
],
];
}
}

View File

@ -120,6 +120,6 @@ class SamplesItem extends FieldItemBase {
*/
public static function fieldSettingsFormValidate(array $form, FormStateInterface $form_state) {
$field = $form_state->getFormObject()->getEntity();
dsm($field);
// dsm($field);
}
}

View File

@ -125,7 +125,7 @@ class SamplesDefaultWidget extends WidgetBase {
// foreach ($values as $key => $value) {
// $values[$key]['value']['target_id'] = (int)$values[$key]['value']['target_id'];
// }
dsm($values);
// dsm($values);
return $values;
}
}