Switch to non-enabled themes

clivesj - May 18, 2008 - 20:18
Project:Switchtheme
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Description

I usually test my new themes within a test environment but sometimes I need to test on the production site.
I would like to be able to awitch to a theme without having the need to enable it first. Especially because I need some user-roles (that have permission) to review those themes before enabling them.
I would like propose attached patch:

  • adds a permission "switch to non-enabled theme"
  • If you have permission to use non-enabled themes there will be a small note ön the theme switch form saying: "Non-enabled themes available".
  • Corrected some coding-standard-things
AttachmentSize
swt_non_enable.patch1.56 KB

#1

sun - May 19, 2008 - 22:40
Component:User interface» Code
Status:active» needs work

I like this idea. However, your coding-style needs work, see http://drupal.org/coding-standards for further information.

#2

clivesj - May 20, 2008 - 16:39

Thanks Sun, can you point some more specific where I missed the standards?

#3

sun - May 21, 2008 - 16:28

- Insert a space after the comma to separate array values.
- Use 2 spaces instead of tabs.
- Else is always on the next line, same indent as If.
...if you already read the coding standards section in the handbooks, then read it again, please. All of this is clearly stated there. Either read, understand, and adapt Drupal's coding standards, or do not post patches. Thanks.

Other than that:
- $note is not initialized.
- We do not use dirty HTML hacks like the one in #suffix in Drupal.
- You accidently removed the form submit button in switchtheme_switch_form().

#4

clivesj - May 22, 2008 - 11:53

Thanks for the pointers,
I will re-do my homework and re-supply a patch

#5

christefano - October 25, 2008 - 06:02

I've noticed on occasion that for anonymous visitors, Switchtheme somehow switched to a theme after the theme has been disabled. It's strange to see this as a feature request.

#6

sun - October 25, 2008 - 13:43

@christefano: This issue is a feature request. What you are reporting is a completely separate issue. Please open a new bug report for it. Thanks.

#7

christefano - October 25, 2008 - 19:11

@sun: I'm aware that this is a feature request and noted that in my comment. If you prefer that I just write "subscribing" instead please let me know. :)

#8

sun - December 2, 2008 - 01:55

Any updates?

#9

clivesj - December 15, 2008 - 12:51

Here's a patch i'm using on my D5 site.
I will install and test the D6 version on my D6 site and provide the patch when ready.
regards

AttachmentSize
nonenabled_d5.patch 1.27 KB

#10

sun - August 10, 2009 - 23:31

+++ switchtheme_patch.module 2008-12-15 13:46:29.281250000 +0100
@@ -23,7 +23,7 @@ function switchtheme_help($section) {
+  return array('administer switch', 'switch theme', 'switch to non-enabled themes');

Uhm - why not simply:

s/non-enabled/disabled/ ;)

+++ switchtheme_patch.module 2008-12-15 13:46:29.281250000 +0100
@@ -121,7 +121,8 @@ function switchtheme_switch_form() {
+    '#description' => user_access('switch to non-enabled themes') ? t('Non-enabled themes available') : '',

I don't think this description is of any help...

+++ switchtheme_patch.module 2008-12-15 13:46:29.281250000 +0100
@@ -164,7 +165,10 @@ function switchtheme_options() {
-    if ($attr->status) {
+    if (user_access('switch to non-enabled themes')) {
+      $options[] = $attr-> name;
+    }
+    elseif ($attr->status) {
       $options[] = $attr->name;
     }

Instead, we should store $attr->name as key and "@themename (disabled)" as value for $options here.

Beer-o-mania starts in 20 days! Don't drink and patch.

 
 

Drupal is a registered trademark of Dries Buytaert.