2

Is there an easy way to override a module located in sites/all/modules directory? Like placing it's customized version into modules/ directory or create one under sites/default/modules?

8

Answering my own question here:

Your installation will choose from the most specific one available (first /sites/sitename/modules (sitename typically might be - default), then /sites/all/modules, then /modules).

from Directory precedence and multi-site considerations.

4
  • Following along here... it looks like if I wanted to override the css of the toolbar module, I would copy /modules/toolbar/toolbar.css and place it in /sites/modules/toolbar/toolbar.css I tried this, but it didn't work. Why not?
    – Ben
    Nov 21 '11 at 13:41
  • 1
    Probably you can't override parts of it, copy over the whole module, alter it (css, js, or anything) and reactivate from backend. That should do.
    – jayarjo
    Nov 21 '11 at 14:30
  • Thanks for the guess, but it had no effect.
    – Ben
    Nov 21 '11 at 17:40
  • I could find no other answer and tried this a couple of more times, and it finally started working. I have no idea what I did wrong the first few times. Or maybe there was a server caching issue separate from the Drupal cache preventing me from seeing the changes.
    – Ben
    Nov 21 '11 at 19:31
1

To get Drupal to recognize the location of an overridden module, you may need to clear caches or rebuild the system registry.

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.