51

Drupal 8 re-arranged all the directories and locations of modules/themes etc. Where do things go now?

75
  • /core - All files provided by core, that doesn't have an explicit reason to be in the / directory. More details futher down.
  • /libraries - 3rd party libraries, eg. a wysiwyg editor. Not included by core, but common enough to warrant inclusion here.
  • /modules - The directory into which all custom and contrib modules go.
    • Splitting this up into the sub-directories contrib and custom can make it easier to keep track of the modules. enough to warrant mention here.
  • /profile - contributed and custom profiles.
  • /themes - contributed and custom (sub)themes
  • sites/[domain OR default]/{modules,themes} - Site specific modules and themes can be moved into these directories to avoid them showing up on every site.
  • sites/[domain OR default]/files - Site specific files tend to go here. This could be files uploaded by users, such as images, but also includes the configuration, active as well as staged config. The configuration is read and written by Drupal, and should have the minimal amount of privileges required for the webserver, and the only the webserver, to read and modify them.
  • /vendor - Backend libraries that Drupal Core depends on. (Symfony, Twig, etc)

Details on the /core directory, primarily useful to know for new core hackers:

  • /core/assets - Various external libraries used by Core. jQuery, underscore, modernizer etc.
  • /core/misc - Frontend code that Drupal Core depends on.
  • /core/includes - Functionality that is to low level to be modular. Such as the module system itself.
  • /core/lib - Drupal Core classes.
  • /core/modules - Drupal Core modules.
  • /core/profiles - Drupal Core installation profiles. Minimal, Standard, Testing and Testing multilingual installation profiles by default.
  • /core/scripts - Various CLI scripts, mostly used by developers.
  • /core/tests - Drupal Core tests.
  • /core/themes - Drupal Core themes.
  • What about the folder for (uploaded) files? – unor Sep 10 '13 at 11:00
  • Excellent question, there's also the new configuration files to take into account. I'll add those as well. – Letharion Sep 10 '13 at 12:44
  • @unor Fixed now. :) – Letharion Sep 14 '13 at 13:18
  • Have an upvote for the /libraries tip. Honestly that should be a bare directory with the core install so it is clear thats where things go... it wasn't clear to me at first. – Kevin Jan 28 '16 at 17:00
17

The folders are:

  • core: This contains all of drupal core except for things that must be in the root, like index.php etc. Generally you shouldn't need to be adding/editing/removing anything in here.
  • themes: This is where you put your site's themes (previously sites/all/themes).
  • modules: This is where you put your site's modules (previously sites/all/modules).
  • profiles: This is where you put installation profiles.
  • sites: This is used for running drupal multi-site setups and is used in the same way as in drupal 7. Modules & themes in sites/all/modules or sites/all/themes, will override ones in the base modules & themes directories. Modules in sites/SITENAME/modules and sites/SITENAME/themes will override others for the given site.

There are arguably better descriptions if you look at the README.txt files in each of the directories.

  • drupal.stackexchange.com/questions/11410/… thanks to @marcvangend – arpitr Sep 6 '13 at 6:29
  • Those answers are out of date. Also, this question was posted as a result of one of the answers in that question. – rooby Sep 6 '13 at 6:34
  • For the persons down voting, please comment as to why and I can address your concerns. My answer isn't as thorough as the accepted one but it is not incorrect as far as I know. – rooby Apr 30 '15 at 6:12

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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