Loading core/lib/Drupal/Core/Extension/Extension.php +13 −0 Original line number Diff line number Diff line Loading @@ -209,4 +209,17 @@ public function isExperimental(): bool { && $this->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::EXPERIMENTAL); } /** * Checks if an extension is marked as obsolete. * * @return bool * TRUE if an extension is marked as obsolete, FALSE otherwise. */ public function isObsolete(): bool { // This function checks for 'lifecycle: obsolete' to determine if an // extension is marked as obsolete. return (isset($this->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER]) && $this->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::OBSOLETE); } } core/modules/system/src/Controller/SystemController.php +6 −1 Original line number Diff line number Diff line Loading @@ -191,7 +191,7 @@ public function systemAdminMenuBlockPage() { } /** * Returns a theme listing. * Returns a theme listing which excludes obsolete themes. * * @return string * An HTML string of the theme listing page. Loading @@ -202,6 +202,11 @@ public function themesPage() { $config = $this->config('system.theme'); // Get all available themes. $themes = $this->themeHandler->rebuildThemeData(); // Remove obsolete themes. $themes = array_filter($themes, function ($theme) { return !$theme->isObsolete(); }); uasort($themes, [ThemeExtensionList::class, 'sortByName']); $theme_default = $config->get('default'); Loading core/modules/system/tests/src/Functional/System/ThemeTest.php +4 −0 Original line number Diff line number Diff line Loading @@ -320,6 +320,10 @@ public function testAdministrationTheme() { $this->drupalGet('admin/appearance'); $this->submitForm($edit, 'Save configuration'); // Check that obsolete themes are not displayed. $this->drupalGet('admin/appearance'); $this->assertSession()->pageTextNotContains('Obsolete test theme'); // Check that the administration theme is used on an administration page. $this->drupalGet('admin/config'); $this->assertSession()->responseContains('core/themes/seven'); Loading core/modules/system/tests/themes/obsolete_theme_test/obsolete_theme_test.info.yml 0 → 100644 +7 −0 Original line number Diff line number Diff line name: 'Obsolete theme test' type: theme description: 'Obsolete test theme.' version: VERSION lifecycle: obsolete lifecycle_link: 'https://example.com/obsolete' base theme: false Loading
core/lib/Drupal/Core/Extension/Extension.php +13 −0 Original line number Diff line number Diff line Loading @@ -209,4 +209,17 @@ public function isExperimental(): bool { && $this->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::EXPERIMENTAL); } /** * Checks if an extension is marked as obsolete. * * @return bool * TRUE if an extension is marked as obsolete, FALSE otherwise. */ public function isObsolete(): bool { // This function checks for 'lifecycle: obsolete' to determine if an // extension is marked as obsolete. return (isset($this->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER]) && $this->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::OBSOLETE); } }
core/modules/system/src/Controller/SystemController.php +6 −1 Original line number Diff line number Diff line Loading @@ -191,7 +191,7 @@ public function systemAdminMenuBlockPage() { } /** * Returns a theme listing. * Returns a theme listing which excludes obsolete themes. * * @return string * An HTML string of the theme listing page. Loading @@ -202,6 +202,11 @@ public function themesPage() { $config = $this->config('system.theme'); // Get all available themes. $themes = $this->themeHandler->rebuildThemeData(); // Remove obsolete themes. $themes = array_filter($themes, function ($theme) { return !$theme->isObsolete(); }); uasort($themes, [ThemeExtensionList::class, 'sortByName']); $theme_default = $config->get('default'); Loading
core/modules/system/tests/src/Functional/System/ThemeTest.php +4 −0 Original line number Diff line number Diff line Loading @@ -320,6 +320,10 @@ public function testAdministrationTheme() { $this->drupalGet('admin/appearance'); $this->submitForm($edit, 'Save configuration'); // Check that obsolete themes are not displayed. $this->drupalGet('admin/appearance'); $this->assertSession()->pageTextNotContains('Obsolete test theme'); // Check that the administration theme is used on an administration page. $this->drupalGet('admin/config'); $this->assertSession()->responseContains('core/themes/seven'); Loading
core/modules/system/tests/themes/obsolete_theme_test/obsolete_theme_test.info.yml 0 → 100644 +7 −0 Original line number Diff line number Diff line name: 'Obsolete theme test' type: theme description: 'Obsolete test theme.' version: VERSION lifecycle: obsolete lifecycle_link: 'https://example.com/obsolete' base theme: false