3

I can see a folder named config in Drupal 8 core modules which contains sub directories like optional, schema and install.

I can see it is like a settings folder which is initialised during module installation. But how do they differ from each other?

3
  • schema: This folder is used for schema related things. This is most often used to tell Drupal how custom configs and config entities will be saved.
  • install: The folder can contain configs, like a view or any other config. All configs will be installed, if any config fails module can't be installed.
  • optional: The folder can contain configs, like a view or any other config. All configs will be installed if possible. If config has missing dependencies, it won't be installed.

Config installation only happen when the module itself is installed. For optional config it can install missing config when dependencies are met by a new module being install.

  • The last sentence is not true for optional config. Every time a module is installed, drupal will try again to install optional config of any already installed (and the new) module if the following two conditions are met: a) all dependencies are now met b) the new module is part of the dependencies (AFAIK, I need to check if we changed that) – Berdir Apr 13 '16 at 16:26
  • @Berdir I haven't seen that behavior but it's been a while since I looked at optional. Updated last sentence to reflect your comment – googletorp Apr 13 '16 at 16:58

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.