diff --git a/core/themes/claro/css/theme/tour.theme.css b/core/modules/tour/css/theme/claro-tour.theme.css similarity index 100% rename from core/themes/claro/css/theme/tour.theme.css rename to core/modules/tour/css/theme/claro-tour.theme.css diff --git a/core/themes/claro/css/theme/tour.theme.pcss.css b/core/modules/tour/css/theme/claro-tour.theme.pcss.css similarity index 100% rename from core/themes/claro/css/theme/tour.theme.pcss.css rename to core/modules/tour/css/theme/claro-tour.theme.pcss.css diff --git a/core/themes/stable9/css/tour/tour.module.css b/core/modules/tour/css/theme/stable9-tour.module.css similarity index 100% rename from core/themes/stable9/css/tour/tour.module.css rename to core/modules/tour/css/theme/stable9-tour.module.css diff --git a/core/themes/stable9/js/tour.js b/core/modules/tour/js/theme/tour.js similarity index 100% rename from core/themes/stable9/js/tour.js rename to core/modules/tour/js/theme/tour.js diff --git a/core/modules/tour/tour.libraries.yml b/core/modules/tour/tour.libraries.yml index 52cbc50573d8f7acfd2ddfa07b0f502ea98834c8..19c0d3a39ca3f488701421c6fdf1afe288b8d31c 100644 --- a/core/modules/tour/tour.libraries.yml +++ b/core/modules/tour/tour.libraries.yml @@ -16,3 +16,17 @@ tour-styling: css: component: css/tour.module.css: { media: screen } + +tour-claro-styling: + version: VERSION + css: + theme: + css/theme/claro-tour.theme.css: {} + +tour-stable9-styling: + version: VERSION + js: + js/theme/tour.js: {} + css: + theme: + css/theme/stable9-tour.module.css: {} diff --git a/core/modules/tour/tour.module b/core/modules/tour/tour.module index da432ef9ed7f23d19b83e9507e817a3e33e42e66..bd05f7311c7358b0b0e0b082552db836b98d5e30 100644 --- a/core/modules/tour/tour.module +++ b/core/modules/tour/tour.module @@ -115,3 +115,23 @@ function tour_tour_insert($entity) { function tour_tour_update($entity) { \Drupal::service('plugin.manager.tour.tip')->clearCachedDefinitions(); } + +/** + * Implements hook_library_info_alter(). + */ +function tour_library_info_alter(&$libraries, $extension) { + if ($extension === 'tour') { + $theme = \Drupal::service('theme.manager')->getActiveTheme()->getName(); + $base_theme = FALSE; + if ($theme && !\Drupal::service('theme_handler')->listInfo()[$theme]) { + $base_theme = \Drupal::service('theme_handler')->listInfo()[$theme]->base_theme; + } + if (in_array('claro', [$theme, $base_theme])) { + $libraries['tour']['dependencies'][] = 'tour/tour-claro-styling'; + } + elseif (in_array('stable9', [$theme, $base_theme])) { + $libraries['tour']['dependencies'][] = 'tour/tour-stable9-styling'; + } + } + +} diff --git a/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php b/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php index 5ba0c7bb4d8f3899bf1be22b1c1cb052c887f033..e31900a27efa1109ac2222787d76f330f7caf42a 100644 --- a/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php +++ b/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php @@ -207,7 +207,10 @@ protected function getAllLibraries() { $extensions = $modules; $module_list = array_keys($modules); sort($module_list); - $this->assertEquals($this->allModules, $module_list, 'All core modules are installed.'); + // Remove deprecated module Tour. + $module_list = array_diff($module_list, ['tour']); + $all_modules = array_diff($this->allModules, ['tour']); + $this->assertEquals($all_modules, $module_list, 'All core modules are installed.'); $themes = $this->themeHandler->listInfo(); $extensions += $themes; @@ -216,7 +219,8 @@ protected function getAllLibraries() { $this->assertEquals($this->allThemes, $theme_list, 'All core themes are installed.'); $libraries['core'] = $this->libraryDiscovery->getLibrariesByExtension('core'); - + // Remove deprecated module Tour. + unset($extensions['tour']); foreach ($extensions as $extension_name => $extension) { $library_file = $extension->getPath() . '/' . $extension_name . '.libraries.yml'; if (is_file($this->root . '/' . $library_file)) { diff --git a/core/tests/Drupal/KernelTests/Core/Theme/Stable9LibraryOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Theme/Stable9LibraryOverrideTest.php index 39ccd4038d535dfbb63e5a73e572563e16142197..20bbe21c5bf37133e644fd24af48dca37ea7f8f4 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/Stable9LibraryOverrideTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/Stable9LibraryOverrideTest.php @@ -26,6 +26,9 @@ class Stable9LibraryOverrideTest extends StableLibraryOverrideTestBase { 'media/drupal.media-icon', 'options/drupal.options-icon', 'telephone/drupal.telephone-icon', + 'tour/tour-styling', + 'tour/tour-claro-styling', + 'tour/tour-stable9-styling', ]; /** diff --git a/core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTestBase.php b/core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTestBase.php index 6e80b20fbd52d03ece7219eaccfa1154c88fb50f..bfe0ecfafd34d13079089e7cd961d5e958e36447 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTestBase.php @@ -121,10 +121,15 @@ protected function getAllLibraries() { $modules = \Drupal::moduleHandler()->getModuleList(); $module_list = array_keys($modules); sort($module_list); - $this->assertEquals($this->allModules, $module_list, 'All core modules are installed.'); + // Remove deprecated module Tour. + $module_list = array_diff($module_list, ['tour']); + $all_modules = array_diff($this->allModules, ['tour']); + $this->assertEquals($all_modules, $module_list, 'All core modules are installed.'); $libraries['core'] = $this->libraryDiscovery->getLibrariesByExtension('core'); + // Remove deprecated module Tour. + unset($modules['tour']); foreach ($modules as $module_name => $module) { $library_file = $module->getPath() . '/' . $module_name . '.libraries.yml'; if (is_file($this->root . '/' . $library_file)) { diff --git a/core/themes/claro/claro.info.yml b/core/themes/claro/claro.info.yml index 5b8fd2393527301e88f3799f7d23e99ff196a0a2..c47d4b86e51c2165c1fe674fc2484c66355dcb85 100644 --- a/core/themes/claro/claro.info.yml +++ b/core/themes/claro/claro.info.yml @@ -128,8 +128,6 @@ libraries-extend: - claro/system.admin core/drupal.autocomplete: - claro/autocomplete - tour/tour-styling: - - claro/tour-styling shortcut/drupal.shortcut: - claro/drupal.shortcut core/drupal.ajax: diff --git a/core/themes/claro/claro.libraries.yml b/core/themes/claro/claro.libraries.yml index 3a16437d1ae7fc80c8ce8e12d226e4c46544e9bd..bcc8788ebea28d90b8506cfe310f619806b4502b 100644 --- a/core/themes/claro/claro.libraries.yml +++ b/core/themes/claro/claro.libraries.yml @@ -139,12 +139,6 @@ drupal.node.preview: theme: css/components/node-preview.css: {} -tour-styling: - version: VERSION - css: - theme: - css/theme/tour.theme.css: {} - media-form: version: VERSION css: diff --git a/core/themes/olivero/css/components/site-header.css b/core/themes/olivero/css/components/site-header.css index 6dc7c5162ac392cb68ede3c6eb62f97b5eb85ded..ecbdc1ea9cc7292cea3595a44eeae3a8e19b5e51 100644 --- a/core/themes/olivero/css/components/site-header.css +++ b/core/themes/olivero/css/components/site-header.css @@ -14,7 +14,7 @@ position: relative; /** * Ensure mobile site header is always above other elements including - * contextual links, and Tour. + * contextual links. */ z-index: 101; } diff --git a/core/themes/olivero/css/components/site-header.pcss.css b/core/themes/olivero/css/components/site-header.pcss.css index 1ab7251194de5f9bb7df75e029907c03187ea502..ee68226463573eb62b2cbb0bdcb43fbe59244dde 100644 --- a/core/themes/olivero/css/components/site-header.pcss.css +++ b/core/themes/olivero/css/components/site-header.pcss.css @@ -9,7 +9,7 @@ position: relative; /** * Ensure mobile site header is always above other elements including - * contextual links, and Tour. + * contextual links. */ z-index: 101; diff --git a/core/themes/stable9/stable9.info.yml b/core/themes/stable9/stable9.info.yml index fd2dd2e022fbbdcc673da392b5d9275d7cbbf7d9..4c757b84feed42ce8d816a28bd2edfd5051c6c68 100644 --- a/core/themes/stable9/stable9.info.yml +++ b/core/themes/stable9/stable9.info.yml @@ -261,11 +261,6 @@ libraries-override: state: css/toolbar.menu.css: css/toolbar/toolbar.menu.css - tour/tour-styling: - css: - component: - css/tour.module.css: css/tour/tour.module.css - update/drupal.update.admin: css: theme: @@ -300,7 +295,3 @@ libraries-override: css: theme: css/field_ui_display_mode_table.css: css/field_ui/field_ui_display_mode_table.css - -libraries-extend: - tour/tour: - - stable9/tour diff --git a/core/themes/stable9/stable9.libraries.yml b/core/themes/stable9/stable9.libraries.yml index 828fdd4aa16d91273f312cc90be2096c72d3dc45..98535a37153f73758a0f4408bab7616023701f8d 100644 --- a/core/themes/stable9/stable9.libraries.yml +++ b/core/themes/stable9/stable9.libraries.yml @@ -8,8 +8,3 @@ normalize: css: base: css/core/assets/vendor/normalize-css/normalize.css: { weight: -20 } - -tour: - version: VERSION - js: - js/tour.js: {}