Skip to content
Snippets Groups Projects
Commit 604def46 authored by catch's avatar catch
Browse files

Issue #3281427 by quietone, nod_, deviantintegral, Spokje: Update Block and...

Issue #3281427 by quietone, nod_, deviantintegral, Spokje: Update Block and Theme setting migrations to not use Bartik and Seven

(cherry picked from commit 5b23a5ea)
parent de30ad77
No related branches found
No related tags found
33 merge requests!8394[warning] array_flip(): Can only flip STRING and INTEGER values, when saving a non-revisionable custom content entity,!7780issue 3443822: fix for 'No route found for the specified format html. Supported formats: json, xml.',!7416Simplify the HTML of field.html.twig,!7150Revert "Issue #3137119 by munish.kumar, johnwebdev, Jaypan, jungle, xjm,...,!5013Issue #3071143: Table Render Array Example Is Incorrect,!4848Issue #1566662: Update module should send notifications on Thursdays,!4792Issue #2230689: Remove redundant "Italic" style,!4782Issue #2662898: "Links" field not displaying on custom view modes,!4220Issue #3368223: Link field > Access to internal links is not checked on display.,!4173Issue #2123543: Add string context and location filters to the translate interface,!3884Issue #3356842,!3870Issue #3087868,!3812Draft: Issue #3339373 by alexpott, andypost, mondrake:...,!3736Issue #3294005: Refactor Claro's form--password-confirm stylesheet,!3686Issue #3219967 against 9.5.x,!3683Issue #2939397: Clearing AliasManager cache with root path raises warning,!3543Issue #3344259: Allow ajax dialog to have focus configurable,!3356Issue #3209129: Scrolling problems when adding a block via layout builder,!2982Issue #3301562: Translate the default settings for this plugin (TimestampAgoFormatter),!2921Issue #1383696: Allow a custom HTML element to be selected for a grouping field,!2920Issue #3260175: Saving media entity without an owner crashes,!2857Issue #3314541: Remove unnecessary fill from SVG icon for the "Media Library" CKEditor 5 button — enabling dark mode support in contrib,!2841Resolve #3296811 "Resourceresponsetrait needs a",!2803Issue #3041402: Add option absolute url in formatter URL to image,!2280Issue #3280415: Metapackage Generator Breaks Under Composer --no-dev,!2205Quote all names in the regions section.,!2050Issue #3272969: Remove UnqiueField constraint.,!1956Issue #3268872: hook_views_invalidate_cache not called when a view is deleted,!1893Issue #3217260: Add a way to make media captions not editable in CKEditor,!1459Issue #3087632: menu_name max length is too long,!878Issue #3221534: throw an exception when IDs passed to loadMultiple() are badly formed,!866Issue #2845319: The highlighting of the 'Home' menu-link does not respect query strings and fragment identifiers,!204Issue #3040556: It is not possible to react to an entity being duplicated
...@@ -71,12 +71,12 @@ process: ...@@ -71,12 +71,12 @@ process:
- region - region
map: map:
garland: garland:
bartik: olivero:
# Garland 6.x --> Bartik 8.x # Garland 6.x --> Olivero
header: header header: header
footer: footer_fifth footer: footer_top
left: sidebar_first left: sidebar
right: sidebar_second right: sidebar
# If mapping fails, put the block in the content region. # If mapping fails, put the block in the content region.
default_value: content default_value: content
weight: weight weight: weight
......
...@@ -74,17 +74,29 @@ process: ...@@ -74,17 +74,29 @@ process:
- region - region
map: map:
bartik: bartik:
bartik: # Bartik 7.x --> Olivero 9.4.x
# Bartik 7.x --> Bartik 8.x olivero:
featured: featured_top featured: highlighted
triptych_first: featured_bottom_first triptych_first: content_below
triptych_middle: featured_bottom_second triptych_middle: content_below
triptych_last: featured_bottom_third triptych_last: content_below
footer_firstcolumn: footer_first footer_firstcolumn: footer_top
footer_secondcolumn: footer_second footer_secondcolumn: footer_top
footer_thirdcolumn: footer_third footer_thirdcolumn: footer_top
footer_fourthcolumn: footer_fourth footer_fourthcolumn: footer_top
footer: footer_fifth footer: footer_bottom
seven:
# Seven 7.x --> Claro 9.4.x
claro:
header: 'header'
pre_content: 'pre_content'
breadcrumb: 'breadcrumb'
highlighted: 'highlighted'
help: 'help'
content: 'content'
page_top: 'page_top'
page_bottom: 'page_bottom'
sidebar_first: 'sidebar_first'
# If mapping fails, put the block in the content region. # If mapping fails, put the block in the content region.
default_value: content default_value: content
weight: weight weight: weight
......
...@@ -36,14 +36,14 @@ protected function setUp(): void { ...@@ -36,14 +36,14 @@ protected function setUp(): void {
parent::setUp(); parent::setUp();
// Install the themes used for this test. // Install the themes used for this test.
$this->container->get('theme_installer')->install(['bartik', 'test_theme']);
$this->installEntitySchema('block_content'); $this->installEntitySchema('block_content');
$this->container->get('theme_installer')->install(['olivero', 'test_theme']);
$this->installConfig(['block_content']); $this->installConfig(['block_content']);
// Set Bartik as the default public theme. // Set Olivero as the default public theme.
$config = $this->config('system.theme'); $config = $this->config('system.theme');
$config->set('default', 'bartik'); $config->set('default', 'olivero');
$config->save(); $config->save();
$this->executeMigrations([ $this->executeMigrations([
...@@ -97,7 +97,7 @@ public function assertEntity(string $id, array $visibility, string $region, stri ...@@ -97,7 +97,7 @@ public function assertEntity(string $id, array $visibility, string $region, stri
*/ */
public function testBlockMigration() { public function testBlockMigration() {
$blocks = Block::loadMultiple(); $blocks = Block::loadMultiple();
$this->assertCount(14, $blocks); $this->assertCount(25, $blocks);
// Check user blocks. // Check user blocks.
$visibility = [ $visibility = [
...@@ -113,7 +113,7 @@ public function testBlockMigration() { ...@@ -113,7 +113,7 @@ public function testBlockMigration() {
'provider' => 'user', 'provider' => 'user',
'label_display' => '0', 'label_display' => '0',
]; ];
$this->assertEntity('user', $visibility, 'sidebar_first', 'bartik', -10, $settings); $this->assertEntity('user', $visibility, 'sidebar', 'olivero', -10, $settings);
$visibility = []; $visibility = [];
$settings = [ $settings = [
...@@ -125,7 +125,7 @@ public function testBlockMigration() { ...@@ -125,7 +125,7 @@ public function testBlockMigration() {
'expand_all_items' => FALSE, 'expand_all_items' => FALSE,
'depth' => 0, 'depth' => 0,
]; ];
$this->assertEntity('user_1', $visibility, 'sidebar_first', 'bartik', -11, $settings); $this->assertEntity('user_1', $visibility, 'sidebar', 'olivero', -11, $settings);
$visibility = [ $visibility = [
'user_role' => [ 'user_role' => [
...@@ -146,7 +146,7 @@ public function testBlockMigration() { ...@@ -146,7 +146,7 @@ public function testBlockMigration() {
'label_display' => '0', 'label_display' => '0',
'items_per_page' => '5', 'items_per_page' => '5',
]; ];
$this->assertEntity('user_2', $visibility, 'sidebar_second', 'bartik', -11, $settings); $this->assertEntity('user_2', $visibility, 'sidebar', 'olivero', -11, $settings);
$visibility = [ $visibility = [
'user_role' => [ 'user_role' => [
...@@ -167,7 +167,7 @@ public function testBlockMigration() { ...@@ -167,7 +167,7 @@ public function testBlockMigration() {
'label_display' => '0', 'label_display' => '0',
'items_per_page' => '10', 'items_per_page' => '10',
]; ];
$this->assertEntity('user_3', $visibility, 'sidebar_second', 'bartik', -10, $settings); $this->assertEntity('user_3', $visibility, 'sidebar', 'olivero', -10, $settings);
// Check system block. // Check system block.
$visibility = [ $visibility = [
...@@ -183,7 +183,7 @@ public function testBlockMigration() { ...@@ -183,7 +183,7 @@ public function testBlockMigration() {
'provider' => 'system', 'provider' => 'system',
'label_display' => '0', 'label_display' => '0',
]; ];
$this->assertEntity('system', $visibility, 'footer_fifth', 'bartik', -5, $settings); $this->assertEntity('system', $visibility, 'footer_top', 'olivero', -5, $settings);
// Check menu blocks. // Check menu blocks.
$settings = [ $settings = [
...@@ -192,7 +192,7 @@ public function testBlockMigration() { ...@@ -192,7 +192,7 @@ public function testBlockMigration() {
'provider' => 'core', 'provider' => 'core',
'label_display' => '0', 'label_display' => '0',
]; ];
$this->assertEntity('menu', [], 'header', 'bartik', -5, $settings); $this->assertEntity('menu', [], 'header', 'olivero', -5, $settings);
// Check aggregator block. // Check aggregator block.
$settings = [ $settings = [
...@@ -203,7 +203,7 @@ public function testBlockMigration() { ...@@ -203,7 +203,7 @@ public function testBlockMigration() {
'block_count' => 7, 'block_count' => 7,
'feed' => '5', 'feed' => '5',
]; ];
$this->assertEntity('aggregator', [], 'sidebar_second', 'bartik', -2, $settings); $this->assertEntity('aggregator', [], 'sidebar', 'olivero', -2, $settings);
// Check book block. // Check book block.
$settings = [ $settings = [
...@@ -213,7 +213,7 @@ public function testBlockMigration() { ...@@ -213,7 +213,7 @@ public function testBlockMigration() {
'label_display' => '0', 'label_display' => '0',
'block_mode' => 'book pages', 'block_mode' => 'book pages',
]; ];
$this->assertEntity('book', [], 'sidebar_second', 'bartik', -4, $settings); $this->assertEntity('book', [], 'sidebar', 'olivero', -4, $settings);
// Check forum block settings. // Check forum block settings.
$settings = [ $settings = [
...@@ -226,7 +226,7 @@ public function testBlockMigration() { ...@@ -226,7 +226,7 @@ public function testBlockMigration() {
'administrative' => '1', 'administrative' => '1',
], ],
]; ];
$this->assertEntity('forum', [], 'sidebar_first', 'bartik', -8, $settings); $this->assertEntity('forum', [], 'sidebar', 'olivero', -8, $settings);
$settings = [ $settings = [
'id' => 'forum_new_block', 'id' => 'forum_new_block',
...@@ -238,7 +238,7 @@ public function testBlockMigration() { ...@@ -238,7 +238,7 @@ public function testBlockMigration() {
'administrative' => '1', 'administrative' => '1',
], ],
]; ];
$this->assertEntity('forum_1', [], 'sidebar_first', 'bartik', -9, $settings); $this->assertEntity('forum_1', [], 'sidebar', 'olivero', -9, $settings);
// Check statistic block settings. // Check statistic block settings.
$settings = [ $settings = [
...@@ -250,7 +250,7 @@ public function testBlockMigration() { ...@@ -250,7 +250,7 @@ public function testBlockMigration() {
'top_all_num' => 8, 'top_all_num' => 8,
'top_last_num' => 9, 'top_last_num' => 9,
]; ];
$this->assertEntity('statistics', [], 'sidebar_second', 'bartik', 0, $settings); $this->assertEntity('statistics', [], 'sidebar', 'olivero', 0, $settings);
// Check custom blocks. // Check custom blocks.
$visibility = [ $visibility = [
...@@ -269,7 +269,7 @@ public function testBlockMigration() { ...@@ -269,7 +269,7 @@ public function testBlockMigration() {
'info' => '', 'info' => '',
'view_mode' => 'full', 'view_mode' => 'full',
]; ];
$this->assertEntity('block', $visibility, 'content', 'bartik', 0, $settings); $this->assertEntity('block', $visibility, 'content', 'olivero', 0, $settings);
$visibility = [ $visibility = [
'request_path' => [ 'request_path' => [
......
...@@ -36,15 +36,15 @@ protected function setUp(): void { ...@@ -36,15 +36,15 @@ protected function setUp(): void {
parent::setUp(); parent::setUp();
// Install the themes used for this test. // Install the themes used for this test.
$this->container->get('theme_installer')->install(['bartik', 'seven']);
$this->installEntitySchema('block_content'); $this->installEntitySchema('block_content');
$this->container->get('theme_installer')->install(['olivero', 'claro']);
$this->installConfig(static::$modules); $this->installConfig(static::$modules);
// Set Bartik and Seven as the default public and admin theme. // Set Olivero and Claro as the default public and admin theme.
$config = $this->config('system.theme'); $config = $this->config('system.theme');
$config->set('default', 'bartik'); $config->set('default', 'olivero');
$config->set('admin', 'seven'); $config->set('admin', 'claro');
$config->save(); $config->save();
$this->executeMigrations([ $this->executeMigrations([
...@@ -113,18 +113,18 @@ public function assertEntity(string $id, string $plugin_id, array $roles, string ...@@ -113,18 +113,18 @@ public function assertEntity(string $id, string $plugin_id, array $roles, string
* Tests the block migration. * Tests the block migration.
*/ */
public function testBlockMigration() { public function testBlockMigration() {
$this->assertEntity('bartik_system_main', 'system_main_block', [], '', 'content', 'bartik', 0, '', '0'); $this->assertEntity('bartik_system_main', 'system_main_block', [], '', 'content', 'olivero', 0, '', '0');
$this->assertEntity('bartik_search_form', 'search_form_block', [], '', 'sidebar_first', 'bartik', -1, '', '0'); $this->assertEntity('bartik_search_form', 'search_form_block', [], '', 'content', 'olivero', -1, '', '0');
$this->assertEntity('bartik_user_login', 'user_login_block', [], '', 'sidebar_first', 'bartik', 0, 'User login title', 'visible'); $this->assertEntity('bartik_user_login', 'user_login_block', [], '', 'content', 'olivero', 0, 'User login title', 'visible');
$this->assertEntity('bartik_system_powered_by', 'system_powered_by_block', [], '', 'footer_fifth', 'bartik', 10, '', '0'); $this->assertEntity('bartik_system_powered_by', 'system_powered_by_block', [], '', 'footer_bottom', 'olivero', 10, '', '0');
$this->assertEntity('seven_system_main', 'system_main_block', [], '', 'content', 'seven', 0, '', '0'); $this->assertEntity('seven_system_main', 'system_main_block', [], '', 'content', 'claro', 0, '', '0');
$this->assertEntity('seven_user_login', 'user_login_block', [], '', 'content', 'seven', 10, 'User login title', 'visible'); $this->assertEntity('seven_user_login', 'user_login_block', [], '', 'content', 'claro', 10, 'User login title', 'visible');
// The d7_custom_block migration should have migrated a block containing a // The d7_custom_block migration should have migrated a block containing a
// mildly amusing limerick. We'll need its UUID to determine // mildly amusing limerick. We'll need its UUID to determine
// bartik_block_1's plugin ID. // bartik_block_1's plugin ID.
$uuid = BlockContent::load(1)->uuid(); $uuid = BlockContent::load(1)->uuid();
$this->assertEntity('bartik_block_1', 'block_content:' . $uuid, ['authenticated'], '', 'highlighted', 'bartik', 0, 'Mildly amusing limerick of the day', 'visible'); $this->assertEntity('bartik_block_1', 'block_content:' . $uuid, ['authenticated'], '', 'content', 'olivero', 0, 'Mildly amusing limerick of the day', 'visible');
// Assert that disabled blocks (or enabled blocks whose plugin IDs could // Assert that disabled blocks (or enabled blocks whose plugin IDs could
// be resolved) did not migrate. // be resolved) did not migrate.
......
...@@ -10,7 +10,7 @@ source: ...@@ -10,7 +10,7 @@ source:
process: process:
# Build the configuration name from the variable name, i.e. # Build the configuration name from the variable name, i.e.
# theme_bartik_settings becomes bartik.settings. # theme_bartik_settings becomes bartik.settings.
theme_name: legacy_theme_name:
- -
plugin: explode plugin: explode
source: name source: name
...@@ -19,6 +19,13 @@ process: ...@@ -19,6 +19,13 @@ process:
plugin: extract plugin: extract
index: index:
- 1 - 1
theme_name:
plugin: static_map
source: '@legacy_theme_name'
bypass: true
map:
bartik: olivero
seven: claro
configuration_name: configuration_name:
plugin: concat plugin: concat
source: source:
......
...@@ -67,6 +67,7 @@ public function import(Row $row, array $old_destination_id_values = []) { ...@@ -67,6 +67,7 @@ public function import(Row $row, array $old_destination_id_values = []) {
// Remove keys not in theme settings. // Remove keys not in theme settings.
unset($theme_settings['configuration_name']); unset($theme_settings['configuration_name']);
unset($theme_settings['theme_name']); unset($theme_settings['theme_name']);
unset($theme_settings['legacy_theme_name']);
if (isset($theme_settings)) { if (isset($theme_settings)) {
theme_settings_convert_to_config($theme_settings, $config); theme_settings_convert_to_config($theme_settings, $config);
$config->save(); $config->save();
......
...@@ -17,8 +17,8 @@ class MigrateThemeSettingsTest extends MigrateDrupal7TestBase { ...@@ -17,8 +17,8 @@ class MigrateThemeSettingsTest extends MigrateDrupal7TestBase {
protected function setUp(): void { protected function setUp(): void {
parent::setUp(); parent::setUp();
// Install bartik and seven themes. // Install Olivero and Claro themes.
\Drupal::service('theme_installer')->install(['bartik', 'seven']); \Drupal::service('theme_installer')->install(['olivero', 'claro']);
$this->executeMigration('d7_theme_settings'); $this->executeMigration('d7_theme_settings');
} }
...@@ -26,7 +26,7 @@ protected function setUp(): void { ...@@ -26,7 +26,7 @@ protected function setUp(): void {
* Tests migration of theme settings to variables to configuration. * Tests migration of theme settings to variables to configuration.
*/ */
public function testMigrateThemeSettings() { public function testMigrateThemeSettings() {
$config = $this->config('bartik.settings'); $config = $this->config('olivero.settings');
$this->assertSame('', $config->get('favicon.path')); $this->assertSame('', $config->get('favicon.path'));
$this->assertTrue($config->get('favicon.use_default')); $this->assertTrue($config->get('favicon.use_default'));
...@@ -40,7 +40,7 @@ public function testMigrateThemeSettings() { ...@@ -40,7 +40,7 @@ public function testMigrateThemeSettings() {
$this->assertSame('public://gnu.png', $config->get('logo.path')); $this->assertSame('public://gnu.png', $config->get('logo.path'));
$this->assertFalse($config->get('logo.use_default')); $this->assertFalse($config->get('logo.use_default'));
$config = $this->config('seven.settings'); $config = $this->config('claro.settings');
$this->assertSame('', $config->get('favicon.path')); $this->assertSame('', $config->get('favicon.path'));
$this->assertTrue($config->get('favicon.use_default')); $this->assertTrue($config->get('favicon.use_default'));
$this->assertFalse($config->get('features.comment_user_picture')); $this->assertFalse($config->get('features.comment_user_picture'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment