Issue #2621798 by quietone, hussainweb, kekkis, Yogesh Pawar, Jo Fitzgerald: Variable to config: global theme settings [d7]
parent
a7507146ff
commit
50e815dca0
|
@ -44093,6 +44093,10 @@ $connection->insert('variable')
|
|||
'name' => 'theme_default',
|
||||
'value' => 's:6:"bartik";',
|
||||
))
|
||||
->values(array(
|
||||
'name' => 'theme_settings',
|
||||
'value' => 'a:16:{s:11:"toggle_logo";i:0;s:11:"toggle_name";i:1;s:13:"toggle_slogan";i:0;s:24:"toggle_node_user_picture";i:0;s:27:"toggle_comment_user_picture";i:0;s:32:"toggle_comment_user_verification";i:0;s:14:"toggle_favicon";i:0;s:16:"toggle_main_menu";i:0;s:21:"toggle_secondary_menu";i:0;s:12:"default_logo";i:1;s:9:"logo_path";s:23:"public://customlogo.png";s:11:"logo_upload";s:0:"";s:15:"default_favicon";i:0;s:12:"favicon_path";s:24:"public://somefavicon.png";s:14:"favicon_upload";s:0:"";s:16:"favicon_mimetype";s:9:"image/png";}',
|
||||
))
|
||||
->values(array(
|
||||
'name' => 'tracker_batch_size',
|
||||
'value' => 'i:999;',
|
||||
|
|
|
@ -258,6 +258,10 @@ class MigrateUpgradeForm extends ConfirmFormBase {
|
|||
'source_module' => 'forum',
|
||||
'destination_module' => 'forum',
|
||||
],
|
||||
'd7_global_theme_settings' => [
|
||||
'source_module' => 'system',
|
||||
'destination_module' => 'system',
|
||||
],
|
||||
'd6_imagecache_presets' => [
|
||||
'source_module' => 'imagecache',
|
||||
'destination_module' => 'image',
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
id: d7_global_theme_settings
|
||||
label: D7 global theme settings
|
||||
migration_tags:
|
||||
- Drupal 7
|
||||
source:
|
||||
plugin: variable
|
||||
variables:
|
||||
- theme_settings
|
||||
process:
|
||||
'features/logo': theme_settings/toggle_logo
|
||||
'features/name': theme_settings/toggle_name
|
||||
'features/slogan': theme_settings/toggle_slogan
|
||||
'features/node_user_picture': theme_settings/toggle_node_user_picture
|
||||
'features/comment_user_picture': theme_settings/toggle_comment_user_picture
|
||||
'features/comment_user_verification': theme_settings/toggle_comment_user_verification
|
||||
'features/favicon': theme_settings/toggle_favicon
|
||||
'logo/use_default': theme_settings/default_logo
|
||||
'logo/path': theme_settings/logo_path
|
||||
'favicon/use_default': theme_settings/default_favicon
|
||||
'favicon/path': theme_settings/favicon_path
|
||||
'favicon/mimetype': theme_settings/favicon_mimetype
|
||||
# Ignore settings not present in Drupal 8
|
||||
# theme_settings/logo_upload
|
||||
# theme_settings/favicon_upload
|
||||
# theme_settings/toggle_main_menu
|
||||
# theme_settings/toggle_secondary_menu
|
||||
destination:
|
||||
plugin: config
|
||||
config_name: system.theme.global
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\system\Kernel\Migrate\d7;
|
||||
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
|
||||
|
||||
/**
|
||||
* Tests migration of global theme settings variables to configuration.
|
||||
*
|
||||
* @group system
|
||||
*/
|
||||
class MigrateGlobalThemeSettingsTest extends MigrateDrupal7TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['system'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->executeMigration('d7_global_theme_settings');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of global theme settings to configuration.
|
||||
*/
|
||||
public function testMigrateThemeSettings() {
|
||||
$config = $this->config('system.theme.global');
|
||||
|
||||
$this->assertSame('image/png', $config->get('favicon.mimetype'));
|
||||
$this->assertSame('public://somefavicon.png', $config->get('favicon.path'));
|
||||
$this->assertFalse($config->get('favicon.use_default'));
|
||||
|
||||
$this->assertFalse($config->get('features.comment_user_picture'));
|
||||
$this->assertFalse($config->get('features.comment_user_verification'));
|
||||
$this->assertFalse($config->get('features.favicon'));
|
||||
$this->assertFalse($config->get('features.node_user_picture'));
|
||||
$this->assertFalse($config->get('features.logo'));
|
||||
$this->assertTrue($config->get('features.name'));
|
||||
$this->assertFalse($config->get('features.slogan'));
|
||||
|
||||
$this->assertSame('public://customlogo.png', $config->get('logo.path'));
|
||||
$this->assertTrue($config->get('logo.use_default'));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue