diff --git a/core/lib/Drupal/Core/Theme/ThemeAccessCheck.php b/core/lib/Drupal/Core/Theme/ThemeAccessCheck.php
index fdd6c77..7f4cefa 100644
--- a/core/lib/Drupal/Core/Theme/ThemeAccessCheck.php
+++ b/core/lib/Drupal/Core/Theme/ThemeAccessCheck.php
@@ -47,17 +47,17 @@ public function access($theme) {
}
/**
- * Indicates whether the theme is accessible based on whether it is installed.
+ * Checks access based on whether it is installed or is hidden.
*
* @param string $theme
* The name of a theme.
*
* @return bool
- * TRUE if the theme is installed, FALSE otherwise.
+ * TRUE if the theme is installed and not hidden, FALSE otherwise.
*/
public function checkAccess($theme) {
$themes = $this->themeHandler->listInfo();
- return !empty($themes[$theme]->status);
+ return !empty($themes[$theme]->status) && empty($themes[$theme]->info['hidden']);
}
}
diff --git a/core/modules/block/block.module b/core/modules/block/block.module
index 29c6e16..f0bbdd3 100644
--- a/core/modules/block/block.module
+++ b/core/modules/block/block.module
@@ -88,8 +88,13 @@ function block_page_top(array &$page_top) {
* An array of theme names.
*/
function block_themes_installed($theme_list) {
+ $theme_info = \Drupal::service('theme_handler')->listInfo();
foreach ($theme_list as $theme) {
- block_theme_initialize($theme);
+ // Don't initialize hidden themes as they are not displayed in the block
+ // management screens.
+ if (empty($theme_info[$theme]->info['hidden'])) {
+ block_theme_initialize($theme);
+ }
}
}
diff --git a/core/modules/system/src/Tests/System/ThemeTest.php b/core/modules/system/src/Tests/System/ThemeTest.php
index 24f2a33..cad1185 100644
--- a/core/modules/system/src/Tests/System/ThemeTest.php
+++ b/core/modules/system/src/Tests/System/ThemeTest.php
@@ -56,7 +56,7 @@ function testThemeSettings() {
// Specify a filesystem path to be used for the logo.
$file = current($this->drupalGetTestFiles('image'));
$file_relative = strtr($file->uri, array('public:/' => PublicStream::basePath()));
- $default_theme_path = 'core/themes/classy';
+ $default_theme_path = 'core/modules/system/tests/themes/test_classy';
$supported_paths = array(
// Raw stream wrapper URI.
@@ -126,6 +126,7 @@ function testThemeSettings() {
// Verify the actual 'src' attribute of the logo being output in a site
// branding block.
$this->drupalPlaceBlock('system_branding_block', ['region' => 'header']);
+ $themes = \Drupal::service('theme_handler')->listInfo();
$this->drupalGet('');
$elements = $this->xpath('//header//a[@rel=:rel]/img', array(
':rel' => 'home',
@@ -272,8 +273,8 @@ function testSwitchDefaultTheme() {
$this->assertText('Bartik(' . t('active tab') . ')', 'Default local task on blocks admin page is the default theme.');
// Switch back to Stark and test again to test that the menu cache is cleared.
$this->drupalGet('admin/appearance');
- // Stark is the second 'Set as default' link.
- $this->clickLink(t('Set as default'), 1);
+ // Stark is the first 'Set as default' link.
+ $this->clickLink(t('Set as default'));
$this->drupalGet('admin/structure/block');
$this->assertText('Stark(' . t('active tab') . ')', 'Default local task on blocks admin page has changed.');
}
@@ -350,9 +351,9 @@ function testUninstallingThemes() {
// Seven is the second in the list.
$this->clickLink(t('Uninstall'));
$this->assertRaw('The Seven theme has been uninstalled');
- // Now uninstall classy.
- $this->clickLink(t('Uninstall'));
- $this->assertRaw('The Classy theme has been uninstalled');
+
+ // Check that the classy theme still can't be uninstalled as it is hidden.
+ $this->assertNoRaw('Uninstall Classy theme', 'A link to uninstall the Classy theme does not appear on the theme settings page.');
}
/**
diff --git a/core/themes/classy/logo.svg b/core/modules/system/tests/themes/test_classy/logo.svg
similarity index 100%
rename from core/themes/classy/logo.svg
rename to core/modules/system/tests/themes/test_classy/logo.svg
diff --git a/core/modules/system/tests/themes/test_classy/test_classy.info.yml b/core/modules/system/tests/themes/test_classy/test_classy.info.yml
new file mode 100644
index 0000000..363c472
--- /dev/null
+++ b/core/modules/system/tests/themes/test_classy/test_classy.info.yml
@@ -0,0 +1,6 @@
+name: Test Classy
+type: theme
+description: A theme that uses classy as a base theme for most testing.
+version: VERSION
+core: 8.x
+base theme: classy
diff --git a/core/profiles/standard/config/install/block.block.classy_page_title.yml b/core/profiles/standard/config/install/block.block.classy_page_title.yml
deleted file mode 100644
index 4236224..0000000
--- a/core/profiles/standard/config/install/block.block.classy_page_title.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-langcode: en
-status: true
-dependencies:
- theme:
- - classy
-id: classy_page_title
-theme: classy
-region: content
-weight: -50
-provider: null
-plugin: page_title_block
-settings:
- id: page_title_block
- label: 'Page title'
- provider: core
- label_display: '0'
-visibility: { }
diff --git a/core/profiles/testing/config/install/system.theme.yml b/core/profiles/testing/config/install/system.theme.yml
index 0defc7e..5997057 100644
--- a/core/profiles/testing/config/install/system.theme.yml
+++ b/core/profiles/testing/config/install/system.theme.yml
@@ -1,2 +1,2 @@
# @todo: Remove this file in https://www.drupal.org/node/2352949
-default: classy
+default: test_classy
diff --git a/core/profiles/testing/testing.info.yml b/core/profiles/testing/testing.info.yml
index 28fc4e8..3962c47 100644
--- a/core/profiles/testing/testing.info.yml
+++ b/core/profiles/testing/testing.info.yml
@@ -11,4 +11,4 @@ dependencies:
- dynamic_page_cache
# @todo: Remove this in https://www.drupal.org/node/2352949
themes:
- - classy
+ - test_classy
diff --git a/core/themes/classy/screenshot.png b/core/themes/classy/screenshot.png
deleted file mode 100644
index 4d8e395..0000000
--- a/core/themes/classy/screenshot.png
+++ /dev/null
@@ -1,159 +0,0 @@
-PNG
-
-
IHDR L [) PLTEjmc >>>WWW;;;QQQBBB®TTT~~~yyy888 DDD*)*333lll&&&^^^HHH000LLLFFFNNNccc---pqp"!"YYYJJJʌvvu{|{[[\eefߚ555ssthghnnn```iiju-*#9C8HB<3
!rrre_T3,$<6.1,>&EHB9"/HDS$*SMC