Отключение системных CSS в Drupal

Drupal 6

  1. function mytheme_preprocess_page(&$vars){
  2.  $css = $vars['css'];
  3. //core modules
  4.  unset($css['all']['module']['modules/node/node.css']);
  5. //contrib
  6.  unset($css['all']['module']['sites/all/modules/contrib/filefield/filefield.css']);
  7. //custom
  8. unset($css['all']['module']['sites/all/modules/custom/mymodule/mymodule.css']);
  9. //theme css
  10. unset($css['all']['theme']['sites/all/themes/mytheme/mytheme.css']);
  11.  
  12.  $vars['styles'] = drupal_get_css($css);
  13. }

Drupal 7

  1. function mymodule_css_alter(&$css) {
  2.   $exclude = array(
  3.  //core
  4.    'modules/system/maintenance.css' => FALSE,
  5. //contrib
  6.     'sites/all/modules/contrib/module/module.css' => FALSE,
  7. //custom
  8.     'sites/all/modules/custom/module/module.css' => FALSE,
  9. //theme
  10.     'sites/all/themes/mytheme/mytheme.css' => FALSE,
  11.   );
  12.   $css = array_diff_key($css, $exclude);
  13. }

0 Комментариев

Добавить комментарий