Admin Theme Support

kwinters - May 20, 2009 - 15:30
Project:Node clone
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Please implement admin theme support (use the admin theme for node cloning if it is also used for node editing).

It seems like the easiest way to do this is to add a hook_init with the following:

<?php
if (variable_get('node_admin_theme', '0') && arg(0) == 'node' && arg(2) == 'clone') {
    global
$custom_theme;
   
$custom_theme = variable_get('admin_theme', '0');
   
drupal_add_css(drupal_get_path('module', 'system') .'/admin.css', 'module');
  }
?>

#1

pwolanin - May 25, 2009 - 18:39

yes, that seems to be what system module is doing (in a pathetically inflexible way)

http://api.drupal.org/api/function/system_init/6

#2

kwinters - June 30, 2009 - 13:24
Status:active» needs review

Provided patch against HEAD, added documentation.

There doesn't appear to be a better way to do this in D6.

AttachmentSize
node_clone_admin_theme.patch.txt 1000 bytes

#3

pwolanin - July 3, 2009 - 01:52

Looks reasonable - does it work?

#4

kwinters - July 6, 2009 - 20:51

Yes. To test, apply the patch, set an admin theme with "Use administration theme for content editing" enabled. Find a node, hit Clone. The theme applied should be the same as for Edit.

If you don't check the content editing box, both Edit and Clone will use the main site theme instead of the admin theme.

#5

tripngroove - September 28, 2009 - 05:08

Great patch, thanks! Someone needs to merge this in :)

 
 

Drupal is a registered trademark of Dries Buytaert.