List Info

Thread: Re: Using Admin Theme on Other Pages




Re: Using Admin Theme on Other Pages
user name
2008-01-08 02:52:12
Sorry, I'm reviving this thread from about a week ago. I've
been in
the process of moving and haven't had a chance to look at it
again
until tonight.

I discovered the problem. I have my custom site module's
weight set to
10, because it has to run after other modules (e.g. webfm*)
and so I
guess it was running after theming.

* Specifically, my hook_form_alter has to run after webfm's
because I
added an extra validation function so that user's are
required to
attach at least one file using webfm to particular node
types.

Maybe someone can shed some light on this. Are there any
other options
for me besides renaming my module z_custom? Am I approaching
this the
wrong way?  Thanks.

Ben


--------------------------PREVIOUS
MESSAGES-------------------------------------
Date: Sun, 30 Dec 2007 18:19:36 -0500
From: Doug Green <douggreendouggreenconsulting.com>
Subject: Re: [development] Using Admin Theme on Other Pages
To: developmentdrupal.org
Message-ID: <47782788.2050906douggreenconsulting.com>
Content-Type: text/plain; charset=UTF-8

Yes, that's pretty much what I do in the civicrm_theme.
http
://cvs.drupal.org/viewvc.py/drupal/contributions/modules/civ
icrm_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();
}

Re: Using Admin Theme on Other Pages
country flaguser name
United States
2008-01-08 08:54:17
Ben Wheeler wrote:
> * Specifically, my hook_form_alter has to run after
webfm's because I
> added an extra validation function so that user's are
required to
> attach at least one file using webfm to particular node
types.
> 
> Maybe someone can shed some light on this. Are there
any other options
> for me besides renaming my module z_custom? Am I
approaching this the
> wrong way?  Thanks.

The first time any theme() function is run is when the theme
is picked; 
you want to make sure your code is run as early as possible
-- in 
hook_init is best. It can be hard to predict when a theme()
function 
might be run, so it's very easy to run into this kind of
problem. Module 
weight may not fix the problem.

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )