If you have a theme that uses a theme engine other then PHPTemplate, it still gives you the option of using that theme. Since the theme's theme engine is not available, it should disable the theme, much like how the module system disables access to a module when a module dependency is not available.

Steps to reproduce:

  1. Install a theme that requires a theme engine other then PHPTemplate, like Bluemarine ETS
  2. Make sure you don't install the theme's dependent theme engine
  3. Visit admin/build/themes and see that you can still use the theme even though its required theme engine is not available
CommentFileSizeAuthor
#79 304540-79.patch6.56 KBtherealssj
#78 304540-78.patch6.57 KBtherealssj
#76 304540-76.patch3.61 KBtherealssj
#71 304540-66.patch3.09 KBr.nabiullin
#67 304540-65.patch3.12 KBr.nabiullin
#65 304540-64.patch89.95 KBr.nabiullin
#63 disable_themes_when-304540-63.patch725.26 KBnesta_
#59 304540-final.patch1.04 KBsudhanshug
#55 disable-themes-when-theme-engine-304540-55.patch887 bytesjyotisankar
#53 disable-themes-when-theme-engine-304540-53.patch940 bytesjyotisankar
#49 304540_49.patch915 bytesravi.khetri
#47 304540_47.patch915 bytesravi.khetri
#43 304540-42-missing_grandaddy_theme-should_fail.patch2.76 KBadammalone
#43 304540-42-missing_grandaddy_theme-should_pass.patch3.82 KBadammalone
#42 304540-42-missing_grandaddy_theme.patch3.82 KBadammalone
#38 304540-38.patch3.86 KBadammalone
#36 304540-36.patch3.86 KBadammalone
#34 304540-34.patch1.06 KBadammalone
#26 304540-26.patch5.88 KBBrockBoland
#23 304540-23_fixed.patch5.8 KBBrockBoland
#23 304540-23_test_only.patch3.48 KBBrockBoland
#20 disable-themes-when-no-base-or-engine-304540-20.patch2.22 KBjaredsmith
#17 disable-themes-when-no-base-or-engine-304540-17.patch2.2 KBadammalone
#16 disable-themes-when-no-base-or-engine-304540-16.patch1.89 KBadammalone
#12 304540-update.patch3.32 KBmarcingy
#11 304540-update.patch2.29 KBmarcingy
#6 missingthemeengine.patch3.33 KBRobLoach
#3 missingthemeengine.patch2.05 KBRobLoach
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dvessel’s picture

Status: Active » Closed (works as designed)

Themes without an engine can be created. See Chameleon.

dvessel’s picture

Status: Closed (works as designed) » Active

Never mind.. Misread, sorry.

RobLoach’s picture

Status: Active » Needs review
FileSize
2.05 KB

What other requirements are there for a theme to be enabled? With this patch, it just checks for the theme engine, the core compatibility, and the PHP version. Anything else? Maybe base themes?

dvessel’s picture

Here are all the .info options.

There's the "base theme". If that's defined but doesn't exist, shouldn't we have the same behavior?

RobLoach’s picture

Assigned: Unassigned » RobLoach
Status: Needs review » Needs work

Adding the base theme as a requirement.

RobLoach’s picture

Title: Disable Theme When Theme Engine Isn't Available » Disable themes when theme engine or base theme arn't available
Status: Needs work » Needs review
FileSize
3.33 KB

There we go.

Anonymous’s picture

Status: Needs review » Needs work

The last submitted patch failed testing.

JohnAlbin’s picture

Subscribing. This is a common problem with Zen sub-themes. “Oh. I need to install the Zen theme, too?” :-p

This should be backported to D6 too, IMO.

Sivaji_Ganesh_Jojodae’s picture

Subscribing. +1 for back-porting to D6.

jbrauer’s picture

Priority: Normal » Major

Another component which may be listed elsewhere but I haven't seen is that the plugin manager happily downloads and installs a sub-theme leading to all sorts of errors if the base theme isn't already installed. Ideally this would be handled in a way similar to module dependencies.

Marking as major because the effect on site administrators will be significant.

marcingy’s picture

Status: Needs work » Needs review
FileSize
2.29 KB

New version of patch againsy current head that checks the engine and base theme presence.

marcingy’s picture

FileSize
3.32 KB

New version of patch that no longer makes the theme active by default and instead prompts the user to visit the admin page to enable it. This then treats themes the same as modules. The validation on the admin page then ensures that we can't enable an unsupported theme.

marcingy’s picture

Issue tags: +String freeze

adding tag

marcingy’s picture

Version: 7.x-dev » 8.x-dev
Assigned: RobLoach » Unassigned
Issue tags: -String freeze

Moving to d8 as we are not going to get this in due to string changes

quicksketch’s picture

Priority: Major » Normal

Per #1050616: Figure out backport workflow from Drupal 8 to Drupal 7, major and critical bugs are now preventing development in other areas of Drupal core. Unless this issue is actually a bug (data loss, functionality not working), we can mark this as a "major feature request" or a "normal bug", but not a "major bug".

adammalone’s picture

Just taking a look at this as it happened to me today. I've rewritten some of the other patches in this queue and made a patch for D8.
First core patch so I hope this works!

adammalone’s picture

Just altered the order a little bit to make it more consistent with existing code.

Status: Needs review » Needs work

The last submitted patch, disable-themes-when-no-base-or-engine-304540-17.patch, failed testing.

adammalone’s picture

Status: Needs work » Needs review
jaredsmith’s picture

Re-rolled this patch to make it work correctly under Drupal 8 dev, and tested the functionality with both a sub-theme with a missing base theme, as well as with a theme that was missing its engine.

adammalone’s picture

Not quite sure a reroll was required to rename elements in an array...

BrockBoland’s picture

Assigned: Unassigned » BrockBoland
Status: Needs review » Needs work
Issue tags: +drupaldelphia2012

@typhonius: Yes, the reroll was necessary, since the array key for base theme name is base theme, not base.

This patch works. I'm working on adding a test case for it now.

BrockBoland’s picture

Assigned: BrockBoland » Unassigned
Status: Needs work » Needs review
FileSize
3.48 KB
5.8 KB

Two files are attached here:

  • 304540-23_test_only.patch contains only the test case, so it will fail tests.
  • 304540-23_fixed.patch contains the test case and the fix from #20, so it will pass tests.

Status: Needs review » Needs work

The last submitted patch, 304540-23_test_only.patch, failed testing.

BrockBoland’s picture

Status: Needs work » Needs review

I uploaded patches in the wrong order, so the test-only patch triggered a status change when it (correctly) failed.

BrockBoland’s picture

FileSize
5.88 KB

Last one, I promise: the last patch mis-used t() in the test case.

Status: Needs review » Needs work
Issue tags: -drupaldelphia2012

The last submitted patch, 304540-26.patch, failed testing.

BrockBoland’s picture

Status: Needs work » Needs review
Issue tags: +drupaldelphia2012

#26: 304540-26.patch queued for re-testing.

sarahjean’s picture

Status: Needs review » Reviewed & tested by the community

I tested this patch, it applied and now instead of 'Enable' 'Enable and Set default' I see 'This theme requires the theme engine ets to operate correctly.'

catch’s picture

Status: Reviewed & tested by the community » Fixed

Looks good to me. Committed/pushed to 8.x.

xjm’s picture

Followup here: #1726810: Theme page test module not marked as "hidden"

Also, was this supposed to be backported? I see string additions, but no string changes, and it is a bugfix. (#14 moved it to D8 without tagging for backport on account of strings.)

David_Rothstein’s picture

Version: 8.x-dev » 7.x-dev
Status: Fixed » Patch (to be ported)
Issue tags: +Needs backport to D7

In principle it seems backportable to me.

David_Rothstein’s picture

Title: Disable themes when theme engine or base theme arn't available » Disable themes when theme engine or base theme aren't available
adammalone’s picture

Version: 7.x-dev » 8.x-dev
Status: Patch (to be ported) » Needs work
FileSize
1.06 KB

There's an issue with this when the you have a subtheme of a subtheme.

Let us use 3 themes: A, B & C

C is a subtheme of B, which is a subtheme of A.

Assume themes B and C are present on the site yet A is not. The code in system.admin.inc only checks the parent base theme, not any further up the chain.

$theme->incompatible_base = (isset($theme->info['base theme']) && !isset($themes[$theme->info['base theme']]));

A real world example of this would be if someone created a rubik subtheme and then downloaded rubik but not tao. The theme page would allow the user to enable the rubik subtheme (but not enable rubik).

Although my patch doesn't cover tests, it does have some logic in it that detects whether all base themes for a theme are present.

adammalone’s picture

Status: Needs work » Needs review

As an explanation:

I noticed that $theme->base_themes is an array of base themes which, if the base theme is not present the value is NULL for the key of that base theme. By using array_filter with no arguments it removes any empty elements hence making the array different to that of a non filtered array of base themes.

adammalone’s picture

FileSize
3.86 KB

Added a patch that includes a test for the above. I've not written a test for core before so I've piggy-backed on the test that was committed to HEAD previously for detecting invalid base theme with my basic test knowledge.

podarok’s picture

Status: Needs review » Needs work

#36

+++ b/core/modules/system/tests/modules/theme_page_test/theme_page_test.module
@@ -16,6 +16,7 @@ function theme_page_test_system_info_alter(&$info, $file, $type) {
-}
\ No newline at end of file
+}

-}

No newline at end of file

+++ b/core/modules/system/tests/themes/test_invalid_basetheme/test_invalid_basetheme_sub.info
@@ -0,0 +1,5 @@
+base theme = test_invalid_basetheme ¶

trailing whitespace

adammalone’s picture

FileSize
3.86 KB

Removed the whitespace and had a go at adding a newline. Not sure if that worked though...

adammalone’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
Issue tags: -Needs backport to D7, -drupaldelphia2012

The last submitted patch, 304540-38.patch, failed testing.

adammalone’s picture

Status: Needs work » Needs review
Issue tags: +Needs backport to D7, +drupaldelphia2012

#38: 304540-38.patch queued for re-testing.

adammalone’s picture

Reroll and retest.

adammalone’s picture

Since I'm adding in another test I've been advised by larowlan to test a patch that includes just the new test and a patch that includes the new test and the fix.

This is to ensure that the test is actually testing what is being fixed.

The last submitted patch, 43: 304540-42-missing_grandaddy_theme-should_pass.patch, failed testing.

jhedstrom’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs reroll
ravi.khetri’s picture

FileSize
915 bytes

Re-rolled.

ravi.khetri’s picture

Issue tags: +SprintWeekend2015
ravi.khetri’s picture

Status: Needs work » Needs review
FileSize
915 bytes

Rerolled

Status: Needs review » Needs work

The last submitted patch, 49: 304540_49.patch, failed testing.

manningpete’s picture

Issue tags: -Needs reroll

Patch applies.

jhedstrom’s picture

Issue tags: +Needs reroll

The reroll above only includes the test, not the fix.

jyotisankar’s picture

Status: Needs work » Needs review
FileSize
940 bytes

Rerolled

Status: Needs review » Needs work

The last submitted patch, 53: disable-themes-when-theme-engine-304540-53.patch, failed testing.

jyotisankar’s picture

Status: Needs work » Needs review
FileSize
887 bytes

Status: Needs review » Needs work

The last submitted patch, 55: disable-themes-when-theme-engine-304540-55.patch, failed testing.

DuttonMa’s picture

Assigned: Unassigned » DuttonMa
DuttonMa’s picture

Assigned: DuttonMa » Unassigned
sudhanshug’s picture

Status: Needs work » Needs review

The last submitted patch, 47: 304540_47.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 59: 304540-final.patch, failed testing.

nesta_’s picture

Status: Needs work » Needs review
FileSize
725.26 KB

Rerolled

Status: Needs review » Needs work

The last submitted patch, 63: disable_themes_when-304540-63.patch, failed testing.

r.nabiullin’s picture

Re-rolled patch from comment #42

Status: Needs review » Needs work

The last submitted patch, 65: 304540-64.patch, failed testing.

r.nabiullin’s picture

FileSize
3.12 KB

code totally outdated so manual reroll

r.nabiullin’s picture

Status: Needs work » Needs review
andypost’s picture

andypost’s picture

+++ b/core/modules/system/tests/themes/test_invalid_basetheme_sub/test_invalid_basetheme_sub.info.yml
@@ -0,0 +1,6 @@
\ No newline at end of file

please add the line break

r.nabiullin’s picture

FileSize
3.09 KB

added the line break

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Looks ready

  • catch committed f33b241 on 8.1.x
    Issue #304540 by typhonius, BrockBoland, nabiyllin, RobLoach, marcingy,...

  • catch committed 496d277 on 8.0.x
    Issue #304540 by typhonius, BrockBoland, nabiyllin, RobLoach, marcingy,...
catch’s picture

Version: 8.0.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed/pushed to 8.1.x and cherry-picked to 8.0.x, thanks!

Moving to 7.x for backport.

therealssj’s picture

Status: Patch (to be ported) » Needs review
FileSize
3.61 KB

Patch rerolled for 7.x

Status: Needs review » Needs work

The last submitted patch, 76: 304540-76.patch, failed testing.

therealssj’s picture

Status: Needs work » Needs review
FileSize
6.57 KB

Missed a few files there.
Here is the full reroll for 7.x

therealssj’s picture

Test fix.
Tested Reroll for 7.x

The last submitted patch, 78: 304540-78.patch, failed testing.

  • catch committed e06c461 on 8.3.x
    Issue #304540 by Rob Loach, marcingy, typhonius, BrockBoland, jaredsmith...
  • catch committed f33b241 on 8.3.x
    Issue #304540 by typhonius, BrockBoland, nabiyllin, RobLoach, marcingy,...

  • catch committed e06c461 on 8.3.x
    Issue #304540 by Rob Loach, marcingy, typhonius, BrockBoland, jaredsmith...
  • catch committed f33b241 on 8.3.x
    Issue #304540 by typhonius, BrockBoland, nabiyllin, RobLoach, marcingy,...

  • catch committed e06c461 on 8.4.x
    Issue #304540 by Rob Loach, marcingy, typhonius, BrockBoland, jaredsmith...
  • catch committed f33b241 on 8.4.x
    Issue #304540 by typhonius, BrockBoland, nabiyllin, RobLoach, marcingy,...

  • catch committed e06c461 on 8.4.x
    Issue #304540 by Rob Loach, marcingy, typhonius, BrockBoland, jaredsmith...
  • catch committed f33b241 on 8.4.x
    Issue #304540 by typhonius, BrockBoland, nabiyllin, RobLoach, marcingy,...

  • catch committed e06c461 on 9.1.x
    Issue #304540 by Rob Loach, marcingy, typhonius, BrockBoland, jaredsmith...
  • catch committed f33b241 on 9.1.x
    Issue #304540 by typhonius, BrockBoland, nabiyllin, RobLoach, marcingy,...