0

I need to remove jquery.ui.theme.css file, for this in my template.php I implement the below mentioned code:

function GNG_css_alter(&$css)
{
unset($css[drupal_get_path('module', 'misc') . '/ui/jquery.ui.theme.css']);
}

but its not working.

0
<?php
/**
 * Implements hook_css_alter().
 */
function seven_css_alter(&$css) {
  // Use Seven's vertical tabs style instead of the default one.
  if (isset($css['misc/vertical-tabs.css'])) {
    unset($css['misc/vertical-tabs.css']['data'] = drupal_get_path('theme', 'seven') . '/vertical- tabs.css');
  }
  // Use Seven's jQuery UI theme style instead of the default one.
  if (isset($css['misc/ui/jquery.ui.theme.css'])) {
    unset($css['misc/ui/jquery.ui.theme.css']['data'] = drupal_get_path('theme', 'seven') . '/jquery.ui.theme.css');
  }
}
1
  • thanku @Adi, I got hint from your answer and solved by using unset($css['misc/ui/jquery.ui.theme.css'] after ifstatement.
    – nomeer
    Nov 6 '15 at 10:54
0

You can use hook_library_alter

function garland_library_alter(&$libraries, $module) {
  if ($module == 'system') {
    $js = drupal_get_path('theme', 'garland') . '/ui/ui.garland.css';
    $libraries['ui']['css'][$js] = $libraries['ui']['css']['misc/ui/ui.theme.css'];
    unset($libraries['ui']['css']['misc/ui/ui.theme.css']);
  }
}
0

The code you have implemented (drupal_get_path('module', 'misc')) asks drupal to check for a module which is named misc , which is probably wrong , so when you use drupal_get_path the first parameter is going to be what object are you going to find is it a Module or is a Theme , the next parameter is the machine name of that object . so you cant find a folder which is called misc just by calling this function . this function leads to root of a theme or module.

so the right code is:

function GNG_css_alter(&$css)
{
  unset($css[drupal_get_path('THEME or MODULE', 'It's NAME') . '/ui/jquery.ui.theme.css']);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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