Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I'm using jquery tabs on my page but they loaded some default styles that I didn't want. Thus I removed them with the following code:

drupal_add_library('system', 'ui.tabs');


function mytheme_css_alter(&$css) {
   // List of disabled drupal default css files.
   $disabled_drupal_css = array(
      // Remove jquery.ui css files.
      'misc/ui/jquery.ui.core.css',
      'misc/ui/jquery.ui.theme.css',
      //  'misc/ui/jquery.ui.tabs.css',
   );

  // Remove drupal default css files.
     foreach ($css as $key => $item) {
         if (in_array($key, $disabled_drupal_css)) {
            // Remove css and its altered version that can be added by jquery_update.
            unset($css[$css[$key]['data']]);
            unset($css[$key]);
         }
     }
}

This seems to do the trick, but I also noticed that my backend is not loading it's styles properly. I guess some of it uses the jquery.ui styles.

How can I load these only for the logged in user but not for

share|improve this question
    
r u writing this in module or theme? –  monymirza Mar 5 '13 at 8:24
    
In theme, in template.php. –  Johan Dahl Mar 5 '13 at 8:25
add comment

2 Answers 2

i guess you use the your theme also as admin theme. just use seven as admin theme, and this hook will not be considered.

otherwise you have to check in the hook if your on an admin page, like

if (path_is_admin(current_path())) {}
share|improve this answer
add comment

I would use user_is_anonymous() function like this:

function yourtheme_css_alter(&$css) { 
  if(user_is_anonymous()) {
    $exclude = array(
      'misc/ui/jquery.ui.core.css' => FALSE,
      'misc/ui/jquery.ui.theme.css' => FALSE,
    );
    $css = array_diff_key($css, $exclude);
  }
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.