diff --git a/core/modules/language/migration_templates/d6_language_content_settings.yml b/core/modules/language/migration_templates/d6_language_content_settings.yml new file mode 100644 index 0000000..6b4f1ae --- /dev/null +++ b/core/modules/language/migration_templates/d6_language_content_settings.yml @@ -0,0 +1,40 @@ +id: d6_language_content_settings +label: Drupal 6 language content settings +migration_tags: + - Drupal 6 +source: + plugin: language_content_settings + constants: + target_type: 'node' +process: + target_bundle: type + target_entity_type_id: 'constants/target_type' + default_langcode: + - + plugin: static_map + source: language_content_type + map: + 0: NULL + 1: 'current_interface' + 2: 'current_interface' + - + plugin: skip_on_empty + method: row + language_alterable: + plugin: static_map + source: i18n_lock_node + map: + 0: true + 1: false + 'third_party_settings/content_translation/enabled': + plugin: static_map + source: language_content_type + map: + 0: NULL + 1: false + 2: true +destination: + plugin: entity:language_content_settings +migration_dependencies: + required: + - d6_node_type diff --git a/core/modules/language/migration_templates/d7_language_content_settings.yml b/core/modules/language/migration_templates/d7_language_content_settings.yml new file mode 100644 index 0000000..3decad7 --- /dev/null +++ b/core/modules/language/migration_templates/d7_language_content_settings.yml @@ -0,0 +1,40 @@ +id: d7_language_content_settings +label: Drupal 7 language content settings +migration_tags: + - Drupal 7 +source: + plugin: language_content_settings + constants: + target_type: 'node' +process: + target_bundle: type + target_entity_type_id: 'constants/target_type' + default_langcode: + - + plugin: static_map + source: language_content_type + map: + 0: NULL + 1: 'current_interface' + 2: 'current_interface' + - + plugin: skip_on_empty + method: row + language_alterable: + plugin: static_map + source: i18n_lock_node + map: + 0: true + 1: false + 'third_party_settings/content_translation/enabled': + plugin: static_map + source: language_content_type + map: + 0: NULL + 1: false + 2: true +destination: + plugin: entity:language_content_settings +migration_dependencies: + required: + - d7_node_type diff --git a/core/modules/language/src/Plugin/migrate/source/LanguageContentSettings.php b/core/modules/language/src/Plugin/migrate/source/LanguageContentSettings.php new file mode 100644 index 0000000..e170d7c --- /dev/null +++ b/core/modules/language/src/Plugin/migrate/source/LanguageContentSettings.php @@ -0,0 +1,73 @@ +select('node_type', 't') + ->fields('t', array( + 'type', + )); + } + + /** + * {@inheritdoc} + */ + public function fields() { + $fields = array( + 'type' => $this->t('Type'), + 'language_content_type' => $this->t('Multilingual support'), + 'i18n_lock_node' => $this->t('Lock language'), + ); + return $fields; + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row) { + $type = $row->getSourceProperty('type'); + $row->setSourceProperty('language_content_type', $this->variableGet('language_content_type_' . $type, NULL)); + if ($this->getModuleSchemaVersion('system') >= 7000) { + $i18n_node_options = $this->variableGet('i18n_node_options_' . $type, NULL); + if ($i18n_node_options && in_array('lock', $i18n_node_options)) { + $row->setSourceProperty('i18n_lock_node', 1); + } + else { + $row->setSourceProperty('i18n_lock_node', 0); + } + } + else { + $row->setSourceProperty('i18n_lock_node', $this->variableGet('i18n_lock_node_' . $type, NULL)); + } + return parent::prepareRow($row); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['type']['type'] = 'string'; + return $ids; + } + +}