7

The new version of Field Group has a new stylesheet included by default that makes my theme look hideous. Deleting the stylesheet from the module's folder fixes the problem but then I will have to delete it again when Field Group is updated again.

What's the right way (= not modifying the module's code directly) to do this?

2 Answers 2

10

I think using hook_css_alter() in a custom module/theme would be the easiest solution:

function MYMODULE_css_alter(&$css) {
  // Get the path to the module
  $path = drupal_get_path('module', 'field_group');

  // Remove the unneeded files from the css array
  unset($css[$path . '/field_group.css']);
  unset($css[$path . '/field_group.field_ui.css']);
}

There are also other CSS files in the Field Group module:

  • horizontal-tabs/horizontal-tabs.css
  • multipage/multipage.css

In case you're look to remove absolutely all the CSS that Field Group introduces.

1
  • Thank you! In this case I only needed to remove multipage/multipage.css. Apr 30, 2012 at 11:56
7

You can also do this in your theme's .info file. Check out the documentation from drupal.org.

If you want to remove css, just add a line like this in your .info file:

stylesheets[all][] = system-menus.css

If you have a stylesheet by that name in your theme, then that will replace the one provided by the module. If you don't have that stylesheet in your theme, then Drupal will just omit that stylesheet altogether.

Looks like there was a bug with this method for a while, but it has seemingly been fixed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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