0

I am trying to unsetting the deafult CSS through a foreach loop, but seems its not working in

hook_preprocess_html(&$variables)

here is my code, please have a look.

$arrCSS = drupal_add_css();
          foreach ($arrCSS as $key => $value) {
            unset($arrCSS[$key]['data']);
          }
          $all_css = drupal_add_css();
          print_r($all_css);

  • Please stop editing your questions to make them useless. – kiamlaluno Jul 21 '15 at 16:11
3

CSS should be manipulated using hook_css_alter(), not in an HTML preprocess (where it's too late).

function hook_css_alter(&$css) {
  // Remove defaults.css file.
  unset($css[drupal_get_path('module', 'system') . '/defaults.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.