[development] Using Admin Theme on Other Pages

Doug Green douggreen at douggreenconsulting.com
Sun Dec 30 23:19:36 UTC 2007


Yes, that's pretty much what I do in the civicrm_theme.

http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/civicrm_theme/civicrm_theme.module?revision=1.1

function civicrm_theme_menu($may_cache) {
  if ($may_cache) {
  }
  elseif (arg(0) == 'civicrm') {
    global $custom_theme;
    $theme_var = arg(1) == 'admin' ? 'civicrm_admin_theme' : 'civicrm_theme';
    if (($custom_theme = variable_get($theme_var, '0')) != '0') {
      $path = drupal_get_path('module', 'system');
      drupal_add_css($path .'/admin.css', 'module');
    }
  }
  return array();
}




Ben Wheeler wrote:
> Hi All,
> I think this is fairly simple to do, but I couldn't find anything in
> the forum/handbooks. I have a theme that's very specific and doesn't
> work well for admin type situations, so I have an admin theme set up.
> I'd like to use my admin theme on other pages, so in my custom module
> hook_menu (taking a cue from system.module) i have:
>
> function custom_menu($may_cache) {
>   $items = array();
>   if ($may_cache) {
>      blah blah blah
>   }
>   else {
>     if (arg(0) == 'webfm' OR arg(0) == 'user') {
>       global $custom_theme;
>       $custom_theme = variable_get('admin_theme', '0');
>     }
>   }
> return $items;
> }
>
> Which doesn't work at all, although it does set the variable
> $custom_theme quite nicely. I'm thinking I have to set this at another
> time, but I don't know how the whole admin theme thing works. Any
> suggestions?  Thanks.
>
> -Ben
>
>   



More information about the development mailing list