Problem/Motivation

Classy will be moved to contrib during Drupal 9. After we have ensured that core themes (Bartik, Claro, Seven, Umami) are not using Classy templates or libraries, we can remove Classy as a base theme of these themes.

Proposed resolution

Change base theme from Classy to Stable. These themes will be made not dependent on Stable in a follow-up #3110855: Plan for removing dependency to Stable in Bartik/Seven/Claro/Umami.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

lauriii created an issue. See original summary.

lauriii’s picture

Status: Active » Needs review
StatusFileSize
new6.54 KB

Let's see what kind test failures this will cause 🤠

Status: Needs review » Needs work

The last submitted patch, 2: 3115088-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

lauriii’s picture

Status: Needs work » Needs review
StatusFileSize
new53.25 KB
new45.47 KB

Removed references to Classy from the themes and also fixed failing tests.

I also removed Drupal\KernelTests\Core\Theme\ThemeNotUsingClassyLibraryTest because it would need a lot of refactoring to make sense. It was mainly designed to support the migration, but if we think it would be valuable enough to rewrite this to work with the changes, it would be possible.

Status: Needs review » Needs work

The last submitted patch, 4: 3115088-4.patch, failed testing. View results

lauriii’s picture

Status: Needs work » Needs review
StatusFileSize
new52.81 KB

Status: Needs review » Needs work

The last submitted patch, 6: 3115088-6.patch, failed testing. View results

lauriii’s picture

Status: Needs work » Needs review
StatusFileSize
new52.14 KB
new2.82 KB

We don't have to replace these libraries - we just have to ensure they are still loaded. I ensured that all of them are loaded either by extending existing library or by directly attaching them in a template.

tim.plunkett’s picture

  1. +++ b/core/modules/block/tests/modules/block_test/config/install/block.block.test_block.yml
    @@ -13,5 +13,5 @@ dependencies:
       theme:
    -    - classy
    +    - stark
    

    This change is either out of scope, or the same change needs to be made to a couple other config files as well.

  2. +++ /dev/null
    @@ -1,447 +0,0 @@
    -class ThemeNotUsingClassyLibraryTest extends KernelTestBase {
    

    This is removed, but not ThemesNotUsingClassyTemplatesTest. Just checking if that's correct.

  3. +++ b/core/themes/seven/seven.info.yml
    --- a/core/themes/seven/seven.libraries.yml
    +++ b/core/themes/seven/seven.libraries.yml
    
    +++ b/core/themes/seven/seven.libraries.yml
    @@ -6,6 +6,28 @@ global-styling:
         component:
    +      css/classy/components/action-links.css: {}
    

    This seemed confusing/wrong at first, but now I see that `css/classy` is a directory *within* Seven, not that this is referring directly to Classy itself. So, not wrong, just confusing :D

  4. I count 10 other test themes that still have base theme: classy
    Is there a follow-up for those, or should they be handled here?
bnjmnm’s picture

Tests depending on Classy are covered by this meta-issue #3083275: [meta] Update tests that rely on Classy to not rely on it anymore (the title of the issue should probably be updated to make it clear it covers all Classy dependencies in tests, not just ones depending on Classy markup)

lauriii’s picture

StatusFileSize
new59.34 KB
new7.01 KB
  1. #9.1: The configuration yml was not valid since at some point Classy was added as a dependency of that block even though it doesn't actually depend on Classy but Stark. The other block configurations still depending Classy still use Classy as the theme, and therefore they should remain depending on Classy. This change was needed to make Drupal\FunctionalTests\Theme\SevenLayoutBuilderTest and Drupal\FunctionalTests\Theme\ClaroLayoutBuilderTest pass.
  2. #9.2 👍
  3. #9.3 +1 😅
  4. #9.4 Is that addressed by #10?
bnjmnm’s picture

Status: Needs review » Reviewed & tested by the community

Almost half the of the 59k is removing tests that aren't necessary after core themes stop declaring Classy as a base theme.

Went through the remaining code and noted the following:

  • Test fixes are straightforward and reflect that fact that core themes are specifying a different base theme
  • Removing image-widget and the assets where unnecessary (👌). It was never loaded by Classy - it was just available for themes that subthemed Classy - so it isn't needed by any core theme that doesn't actively use it.
  • Reviewed each removed library in libraries-override and confirmed the library would still load either from declaring it in libraries: or it is requested by a template via attach_library. Also confirmed that any files previously loaded by an override of classy/base were now included in the theme's global-styling.
tim.plunkett’s picture

Cross-post, was just going to RTBC as well. #10 and #11 addressed my concerns. Thanks!

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/modules/system/system.install
    @@ -1271,3 +1272,18 @@ function system_update_9000() {
    +/**
    + * Uninstall Classy if it is no longer needed.
    + */
    +function system_update_9001() {
    +  /** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
    +  $theme_installer = \Drupal::getContainer()->get('theme_installer');
    +  try {
    +    $theme_installer->uninstall(['classy']);
    +  }
    +  catch (\InvalidArgumentException | UnknownExtensionException $exception) {
    +    // Exception is thrown if Classy wasn't installed or if there are themes
    +    // depending on it.
    +  }
    +}
    

    @catch has been avoiding a hook_update_N because it backs us into a corner with supporting 8.9.x and 9.0.x at the same time. I think this can be a post update. They don't have the same issues with numbering.

  2. +++ b/core/modules/system/tests/src/Functional/Update/ClassyUninstallUpdateTest.php
    @@ -0,0 +1,87 @@
    +/**
    + * Ensures that update hook uninstalls Classy when it's no longer needed.
    + *
    + * @group Update
    + */
    +class ClassyUninstallUpdateTest extends UpdatePathTestBase {
    

    <3 - really great to a comprehensive test.

lauriii’s picture

Status: Needs work » Needs review
StatusFileSize
new59.4 KB
new3.01 KB

Moved the update hook to post update. 👍

lauriii’s picture

Issue tags: -Needs change record

The CR for this can be found here: https://www.drupal.org/node/3103178.

alexpott’s picture

+++ b/core/modules/system/system.post_update.php
@@ -316,3 +317,18 @@ function system_post_update_entity_revision_metadata_bc_cleanup() {
+  catch (\InvalidArgumentException | UnknownExtensionException $exception) {
+    // Exception is thrown if Classy wasn't installed or if there are themes
+    // depending on it.
+  }

This also stops it being uninstalled if classy if the admin or default theme. Which imo is a nice outcome.

bnjmnm’s picture

Status: Needs review » Reviewed & tested by the community

#15 successfully moves the Classy uninstall from hook_update_N to a post update. Switching back to RTBC.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 458e132 and pushed to 9.0.x. Thanks!

  • alexpott committed 458e132 on 9.0.x
    Issue #3115088 by lauriii, bnjmnm, tim.plunkett: Remove Classy as a base...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.