Skip to content

Instantly share code, notes, and snippets.

@cecilemuller
Created March 4, 2012 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cecilemuller/1973090 to your computer and use it in GitHub Desktop.
Save cecilemuller/1973090 to your computer and use it in GitHub Desktop.
Force the admin theme on additional non-admin paths in Drupal 6
<?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