Problem/Motivation

When #3124762: Add 'lifecycle' key to .info.yml files is committed, we will have three new non-stable theme states. At present there is a visual affordance to experimental themes at admin/appearance. But nothing at present for obsolete and deprecated.

Proposed resolution

Promote the non-stable statuses in admin/appearance page, optionally even visually

Remaining tasks

Review
Commit

User interface changes

API changes

Data model changes

Release notes snippet

Comments

larowlan created an issue. See original summary.

larowlan’s picture

Status: Active » Postponed
larowlan’s picture

Title: [PP-1] Promote the non-stable statuses in admin/appearance page, optionally even visually » Promote the non-stable statuses in admin/appearance page, optionally even visually
Status: Postponed » Active

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

catch’s picture

Priority: Normal » Major

Marked #3084816: Determine how to deprecate themes as duplicate.

On #3084816-21: Determine how to deprecate themes Gabor mentioned the possibility of not actually highlighting this on the appearance page, although not sure where that was discussed in more depth.

Bumping this to major since we at least need to discuss it.

gábor hojtsy’s picture

I think it depdends on how actionable the information is. That is it deprecated is not useful in itself.

quietone’s picture

It seems strange to me to indicate non-stable statuses for modules but not themes.

catch’s picture

If a theme is deprecated, there are broadly three options:

1. Switch to a contrib version of the same theme.
2. Switch to a different theme.
3. Fork the theme and continue using it.

However at least with core themes, if you're going to do option 1, you don't actually have to switch until you do a major update of core.

gábor hojtsy’s picture

To elaborate more, I think its a good idea to indicate non-stable status for themes. Depending on how we can surface the lifecycle link on the UI which would provide the detailed info.

xjm’s picture

Issue tags: +Drupal 10

I do think we need to do this in order to deprecate Bartik/Seven/etc.

quietone’s picture

Issue summary: View changes
StatusFileSize
new123 KB
new124.5 KB
new52.24 KB
new2.46 KB

I borrowed code from ModulesListForm to see what this would look like for themes. Since I have not looked at tests, I am not running the tests.

catch’s picture

Status: Active » Needs work
Issue tags: +Needs tests

That looks like a very good start to me.

murilohp’s picture

Issue summary: View changes
Issue tags: -Needs tests
StatusFileSize
new3.46 KB
new1.37 KB

I added a new test to validate the experimental and deprecated themes on the page on this patch, and also changed the $theme->notes to set the $notes just when we have it, this way we avoid empty parenthesis on the theme name. I'll leave this as NW to see which tests will fail from testbot.

gábor hojtsy’s picture

Issue summary: View changes

Fix issue summary markup, inline images but keeping them links.

gábor hojtsy’s picture

Issue tags: +Needs screenshots
+++ b/core/modules/system/src/Controller/SystemController.php
@@ -347,18 +349,33 @@ public function themesPage() {
+        $notes = Link::fromTextAndUrl($this->t( '@lifecycle', ['@lifecycle' => ucfirst($lifecycle)]),

Tesbot fails on phpcs due to the space in the t( '@lifecycle' here I believe.

Screenshots will need to be updated for the fixed parenthesis.

murilohp’s picture

StatusFileSize
new3.46 KB
new996 bytes
new824 bytes

Hey, fixing phpcs error(#16), I forgot to upload a test-only patch, so here it is.

Thanks!

murilohp’s picture

Issue summary: View changes
Issue tags: -Needs screenshots
StatusFileSize
new88.63 KB

I updated the screenshots on the IS

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new3.4 KB
new4.08 KB

Making more changes to the theme notes which will allow the test to pass.

It should be mentioned that the appearance page adds '(experimental)' to experimental theme but that is not done on the modules page. There 'experimental' is not shown unless there is a lifecycle_link. It would be good to have these two page look that same.

quietone’s picture

Issue tags: +Needs change record
quietone’s picture

StatusFileSize
new1.81 KB
new4.58 KB

This just adds a class 'theme-link--non-stable' and uses that instead of 'module-link--non-stable'.

dww’s picture

Issue tags: -Needs change record

Here's a draft CR: https://www.drupal.org/node/3262421

Very quick skim of the patch looks good. I hope to have time for a more thorough review in the next few days, but I wanted to at least help this along in some meaningful way with the time I had. ;)

I do agree with @quietone in #20 that it's unfortunate that the handling of 'Experimental' is different. And it's true that the scope for this issue is to get the warnings right on admin/appearance for non-stable themes. So in theory, cleaning up + standardizing experimental could be in scope. But the theme and modules pages already look wildly different, so there's no way we're really going to get parity here. So I'm really not sure we should be holding this up to sort that out. I think a follow-up to address that would be best. Thoughts?

Thanks!
-Derek

xjm’s picture

Did #21 get deleted by a crosspost? Weirdly, I get a 403 if I try to queue a test for it.

larowlan’s picture

Issue summary: View changes
  1. +++ b/core/modules/system/src/Controller/SystemController.php
    @@ -356,8 +357,40 @@ public function themesPage() {
    +        if (!empty($theme->info[ExtensionLifecycle::LIFECYCLE_LINK_IDENTIFIER])) {
    +          $notes = Link::fromTextAndUrl($this->t('@lifecycle', ['@lifecycle' => ucfirst($lifecycle)]),
    +            Url::fromUri($theme->info[ExtensionLifecycle::LIFECYCLE_LINK_IDENTIFIER], [
    +              'attributes' =>
    +                [
    +                  'class' => 'module-link--non-stable',
    +                  'aria-label' => $this->t('View information on the @lifecycle status of the theme @theme', [
    +                    '@lifecycle' => ucfirst($lifecycle),
    +                    '@theme' => $theme->info['name'],
    +                  ]),
    +                ],
    +            ])
    +          )->toString();
    +        }
    +        $theme->notes[] = $notes;
    

    I think we can remove this hunk and remove the else below, as this would be covered by the inner if there.

    I think this 'isExperimental' condition would add the default of 'experimental theme' (fallback) and then if we remove the else, the subsequent if would check for a link and use that over the fallback

    This would remove the duplication of the code that generates the link

    Hopefully that makes sense, this is where the 'suggestion' feature of an MR would be an advantage

  2. +++ b/core/modules/system/tests/src/Functional/System/ThemeTest.php
    @@ -501,6 +501,16 @@ public function testThemeSettingsNoLogoNoFavicon() {
    +  public function testNonStableStatus() {
    

    Is there an existing test we could tack this onto, and avoid paying the setup cost of a functional test for a couple of asserts

quietone’s picture

Issue summary: View changes
StatusFileSize
new4.36 KB
new3.81 KB

#24
1. No, it didn't make sense but I've reworked the logic.
2. Tacked onto testAdministrationTheme().

quietone’s picture

Obsolete modules are listed on the modules page so I assume that obsolete themes should be listed. If that is what we want then an obsolete test theme needs to be added and tested.

And I just set a theme to obsolete and then it was successfully installed. ;-)

quietone’s picture

Ah, obsolete modules should not be shown in the UI according to #3258782-13: Do not display obsolete modules at admin/modules. Since they do show in the UI that will need an issue, if there isn't already one.

quietone’s picture

Created an issue to remove display of obsolete themes. #3265362: Do not display obsolete themes at admin/appearance

daffie’s picture

Status: Needs review » Reviewed & tested by the community

All the code changes look good to me.
I have run the ThemeTest without the fix on my local machine and it fails.
For me it is RTBC.

  • larowlan committed c7efd92 on 10.0.x
    Issue #3215044 by quietone, murilohp, larowlan, Gábor Hojtsy, catch, xjm...

  • larowlan committed fd949e5 on 9.4.x
    Issue #3215044 by quietone, murilohp, larowlan, Gábor Hojtsy, catch, xjm...
larowlan’s picture

Status: Reviewed & tested by the community » Fixed

Committed c7efd92 and pushed to 10.0.x. Thanks!

Backported to 9.4.x

Published the change record

Great work all.

xjm’s picture

Uncrediting self.

  • larowlan committed a8ad60c on 10.0.x
    Revert "Issue #3215044 by quietone, murilohp, larowlan, Gábor Hojtsy,...
larowlan’s picture

Status: Fixed » Needs work

This broke tests on 10.0.x

Reverted from both

  • larowlan committed 2103b19 on 9.4.x
    Revert "Issue #3215044 by quietone, murilohp, larowlan, Gábor Hojtsy,...
larowlan’s picture

+++ b/core/modules/system/tests/src/Functional/System/ThemeTest.php
@@ -288,6 +288,12 @@ public function testAdministrationTheme() {
+    $this->assertSession()->pageTextContains('Experimental test 9.4.0-dev (experimental theme)');
+    $this->assertSession()->pageTextContains('Test deprecated theme 9.4.0-dev (Deprecated)');
The text "Experimental test 9.4.0-dev (experimental theme)" was not found anywhere in the text of the current page.

This was the fail on 10.0.x, obviously 9.4.x won't show up there

quietone’s picture

Version: 9.4.x-dev » 10.0.x-dev
Status: Needs work » Fixed
StatusFileSize
new1.26 KB
new4.08 KB

Added some future proofing. This works locally for 9.4.x and 10.0.x.

quietone’s picture

Status: Fixed » Needs review
dww’s picture

Status: Needs review » Reviewed & tested by the community

Future proofing looks great, thanks! Bot’s happy on both branches. Interdiff is small, clear, simple and means we won’t have to keep changing this test every version. Re-RTBC.

  • catch committed 44a1bff on 10.0.x
    Issue #3215044 by quietone, murilohp, larowlan, Gábor Hojtsy, catch, dww...
  • catch committed 2afbf15 on 9.4.x
    Issue #3215044 by quietone, murilohp, larowlan, Gábor Hojtsy, catch, dww...
catch’s picture

Version: 10.0.x-dev » 9.4.x-dev
Status: Reviewed & tested by the community » Fixed

Test change looks great. Committed/pushed to 10.0.x and cherry-picked to 9.4.x, thanks!

Status: Fixed » Closed (fixed)

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