Update to Drupal 8.1.5. For more information, see https://www.drupal.org/project/drupal/releases/8.1.5
This commit is contained in:
parent
13b6ca7cc2
commit
38ba7c357d
342 changed files with 7814 additions and 1534 deletions
|
@ -0,0 +1,44 @@
|
|||
id: d6_language_content_settings
|
||||
label: Drupal 6 language content settings
|
||||
migration_tags:
|
||||
- Drupal 6
|
||||
source:
|
||||
plugin: d6_language_content_settings
|
||||
constants:
|
||||
target_type: 'node'
|
||||
process:
|
||||
# Ignore i18n_node_options_[node_type] options not available in Drupal 8,
|
||||
# i18n_required_node and i18n_newnode_current
|
||||
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:
|
||||
# In the case of being 0, it will be skipped. We are not actually setting
|
||||
# a null value.
|
||||
0: NULL
|
||||
1: false
|
||||
2: true
|
||||
destination:
|
||||
plugin: entity:language_content_settings
|
||||
migration_dependencies:
|
||||
required:
|
||||
- d6_node_type
|
|
@ -0,0 +1,44 @@
|
|||
id: d7_language_content_settings
|
||||
label: Drupal 7 language content settings
|
||||
migration_tags:
|
||||
- Drupal 7
|
||||
source:
|
||||
plugin: d7_language_content_settings
|
||||
constants:
|
||||
target_type: 'node'
|
||||
process:
|
||||
# Ignore i18n_node_options_[node_type] options not available in Drupal 8,
|
||||
# i18n_required_node and i18n_newnode_current
|
||||
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:
|
||||
# In the case of being 0, it will be skipped. We are not actually setting
|
||||
# a null value.
|
||||
0: NULL
|
||||
1: false
|
||||
2: true
|
||||
destination:
|
||||
plugin: entity:language_content_settings
|
||||
migration_dependencies:
|
||||
required:
|
||||
- d7_node_type
|
|
@ -40,7 +40,7 @@ class DefaultLanguageItem extends LanguageItem {
|
|||
* The entity whose language code to be loaded.
|
||||
*
|
||||
* @return string
|
||||
* A string language code.
|
||||
* A string language code.
|
||||
*/
|
||||
public function getDefaultLangcode(EntityInterface $entity) {
|
||||
return language_get_default_langcode($entity->getEntityTypeId(), $entity->bundle());
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\language\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate\Row;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Drupal multilingual node settings from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d6_language_content_settings",
|
||||
* )
|
||||
*/
|
||||
class LanguageContentSettings extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
return $this->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));
|
||||
$row->setSourceProperty('i18n_lock_node', $this->variableGet('i18n_lock_node_' . $type, 0));
|
||||
return parent::prepareRow($row);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['type']['type'] = 'string';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\language\Plugin\migrate\source\d7;
|
||||
|
||||
use Drupal\migrate\Row;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Drupal multilingual node settings from database.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "d7_language_content_settings",
|
||||
* )
|
||||
*/
|
||||
class LanguageContentSettings extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
return $this->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));
|
||||
$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);
|
||||
}
|
||||
return parent::prepareRow($row);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['type']['type'] = 'string';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\language\Kernel\Migrate\d6;
|
||||
|
||||
use Drupal\language\Entity\ContentLanguageSettings;
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Tests migration of language content setting variables,
|
||||
* language_content_type_$type, i18n_node_options_* and i18n_lock_node_*.
|
||||
*
|
||||
* @group migrate_drupal_6
|
||||
*/
|
||||
class MigrateLanguageContentSettingsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['node', 'text', 'language', 'content_translation'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->installConfig(['node']);
|
||||
$this->executeMigrations(['d6_node_type', 'd6_language_content_settings']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of content language settings.
|
||||
*/
|
||||
public function testLanguageContent() {
|
||||
// Assert that a translatable content is still translatable.
|
||||
$config = $this->config('language.content_settings.node.article');
|
||||
$this->assertSame($config->get('target_entity_type_id'), 'node');
|
||||
$this->assertSame($config->get('target_bundle'), 'article');
|
||||
$this->assertSame($config->get('default_langcode'), 'current_interface');
|
||||
$this->assertTrue($config->get('third_party_settings.content_translation.enabled'));
|
||||
|
||||
// Assert that a non-translatable content is not translatable.
|
||||
$config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'company');
|
||||
$this->assertTrue($config->isDefaultConfiguration());
|
||||
$this->assertFalse($config->isLanguageAlterable());
|
||||
$this->assertSame($config->getDefaultLangcode(), 'site_default');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of content language settings when there is no language lock.
|
||||
*/
|
||||
public function testLanguageContentWithNoLanguageLock() {
|
||||
// Assert that a we can assign a language.
|
||||
$config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'employee');
|
||||
$this->assertSame($config->getDefaultLangcode(), 'current_interface');
|
||||
$this->assertTrue($config->isLanguageAlterable());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\language\Kernel\Migrate\d7;
|
||||
|
||||
use Drupal\language\Entity\ContentLanguageSettings;
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
|
||||
|
||||
/**
|
||||
* Tests migration of language content setting variables,
|
||||
* language_content_type_$type, i18n_node_options_* and i18n_lock_node_*.
|
||||
*
|
||||
* @group migrate_drupal_7
|
||||
*/
|
||||
class MigrateLanguageContentSettingsTest extends MigrateDrupal7TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['node', 'text', 'language', 'content_translation'];
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->installConfig(['node']);
|
||||
$this->executeMigrations(['d7_node_type', 'd7_language_content_settings']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of content language settings.
|
||||
*/
|
||||
public function testLanguageContent() {
|
||||
// Assert that a translatable content is still translatable.
|
||||
$config = $this->config('language.content_settings.node.blog');
|
||||
$this->assertIdentical($config->get('target_entity_type_id'), 'node');
|
||||
$this->assertIdentical($config->get('target_bundle'), 'blog');
|
||||
$this->assertIdentical($config->get('default_langcode'), 'current_interface');
|
||||
$this->assertFalse($config->get('language_alterable'));
|
||||
$this->assertTrue($config->get('third_party_settings.content_translation.enabled'));
|
||||
|
||||
// Assert that a non-translatable content is not translatable.
|
||||
$config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'page');
|
||||
$this->assertTrue($config->isDefaultConfiguration());
|
||||
$this->assertFalse($config->isLanguageAlterable());
|
||||
$this->assertSame($config->getDefaultLangcode(), 'site_default');
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue