Posted by kwinters on May 20, 2009 at 3:30pm
| Project: | Node clone |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | patch (to be ported) |
Issue Summary
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');
}
?>
Comments
#1
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
Provided patch against HEAD, added documentation.
There doesn't appear to be a better way to do this in D6.
#3
Looks reasonable - does it work?
#4
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
Great patch, thanks! Someone needs to merge this in :)
#6
Subscribing.
#7
I used the themekey module to accomplish the same behavior, as a workaround.
In admin/settings/themekey, I added the following rule: drupal:path = node/#/clone
Just mentioning it here in case someone needs it.
#8
comitted to 6.x-1.x. Need to be ported to Drupal 7 version whenever that's ready.
#9
I just found an issue regarding this code.
It works fine as long as no other module has already invoked a call to init_theme().
But it is possible that another module's hook_init() might invoke a function from theme.inc which might cause the invokation of init_theme(). init_theme() sets the global variable $theme, and then when it's called again it doesn't execute anything. The simplest fix would be to unset it :)
Attached is a patch for this :)
#10
Actually i'm not so sure about the patch i submitted in my previous comment. It needs to be verified performance-wise. (could this be causing the theme registry to be rebuilt on every page request?)