Created
March 4, 2012 13:51
-
-
Save cecilemuller/1973090 to your computer and use it in GitHub Desktop.
Force the admin theme on additional non-admin paths in Drupal 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* In this example, it uses the administration theme on "node creation", "node edition", | |
* "user registration", "user profile" and "forgot password" pages. | |
*/ | |
function MODULENAME_init(){ | |
// The list of paths on which to use the administration theme | |
$patterns = array( | |
'user', | |
'user/*', | |
'user/password', | |
'user/*/edit', | |
'node/add/*', | |
'node/*/edit', | |
'node/*/delete' | |
); | |
$path = drupal_get_path_alias($_GET['q']); | |
$use_admin_theme = false; | |
foreach ($patterns as $pattern){ | |
if (drupal_match_path($path, $pattern)){ | |
$use_admin_theme = true; | |
break; | |
} | |
} | |
if ($use_admin_theme){ | |
global $custom_theme; | |
$custom_theme = variable_get('admin_theme', '0'); | |
drupal_add_css(drupal_get_path('module', 'system') .'/admin.css', 'module'); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment