Themeswitcher module patch

agentrickard - September 4, 2006 - 16:21
Project:Drupal.org webmasters
Component:web site
Category:task
Priority:normal
Assigned:agentrickard
Status:patch (code needs review)
Description

As requested on the themes list, I have corrected some of the errors in the themeswitcher.module.

Attached is a patch vs. cvs. I will also attach the entire new file, just for simplicity.

AttachmentSize
themeswitcher.patch4.68 KB

#1

agentrickard - September 4, 2006 - 16:22

The new code has some substantial changes from prior (since my handling of arrays is more simplistic).

it may be easier, then, to just replace the whole file. Attached is the new module version.

AttachmentSize
themeswitcher.module5.42 KB

#2

agentrickard - September 4, 2006 - 18:38

I went ahead and coded a themeswitcher_page function and menu element.

This gives an overview page that allows for theme selection.

This patch replaces the above.

AttachmentSize
themeswitcher_page.patch8.68 KB

#3

agentrickard - September 4, 2006 - 18:38

New module attached.

AttachmentSize
themeswitcher_0.module9.15 KB

#4

agentrickard - September 4, 2006 - 18:43

Screenshot of themeswitcher_page callback.

AttachmentSize
ts.png116.68 KB

#5

agentrickard - September 4, 2006 - 18:49
Status:active» patch (code needs review)

#6

Bèr Kessels - September 4, 2006 - 22:32

Add a comment to become subscribed.
The code looks very nice, but I'd need to review it a bit closer (and test it! ) :)

#7

agentrickard - September 5, 2006 - 13:30

There's at least one error. In themeswitcher_get_current() line 297, I need to invoke global $user as well.

-   global $custom_theme;
+   global $custom_theme, $user;

This function grabs the user's current theme setting. Failing to invoke global $user may overlook a custom setting.

Attached minor correction to the module file.

The other 'big' code question is whether this module is now themed correctly. The only theme function I use format the individual table cells on the overview page. Drupal standards might mean that the whole themeswitcher_page() function go to a theme function.

AttachmentSize
themeswitcher_1.module9.16 KB

#8

agentrickard - September 5, 2006 - 13:51

Fixed a dumb math error in the themeswitcher_page() logic.

AttachmentSize
themeswitcher_2.module9.2 KB

#9

agentrickard - September 5, 2006 - 13:59

Fixed a missing & on line 281.

AttachmentSize
themeswitcher_3.module9.2 KB

#10

Bèr Kessels - September 8, 2006 - 15:23

First, lets make a real patch.

AttachmentSize
82340_themeswitcher_module.patch.txt8.65 KB
 
 

Drupal is a registered trademark of Dries Buytaert.