I am adding a contrib module to a project and I would like the module enabling to happen automatically on deployment. My deployment script pulls the code and runs a config update via drush config-import. What would the YML be to enable the module in the codebase on config update?
1 Answer
To enable a module, you just need a line in core.extension.yml
. However, you also need all the configuration the module provides. You could copy that over yourself from the config install and optional folder.
But the usual workflow is that at you enable the module manually at some point, using drush or the UI, then optionall customize the configuration and then export the config and deploy that.
-
Thanks @Berdir - what is the number next to each module entry in
core.extension.yml
? e.g.:redirect: 0
- Looking a most of them I had assumed that the number was a boolean to denote if the module is installed or uninstalled, but actually I don't think it is, for 2 reasons. First of all, when I look at the installed state of the module module in the site admin at:admin/modules
, e.g. forredirect
I can see that it is enabled, and incore.extension.yml
it's corresponding entry isredirect: 0
So it can't be a boolean for installed state. Jul 25, 2017 at 15:48 -
2Secondly, the entry in
core.extension.yml
for paragraphs module I have on my site is:paragraphs: 11
i.e. not the value of 'one' but 'eleven'. So 2 things to conclude: 1) The module just has to be present incore.extension.yml
to be enabled 2) the value next to it its not the boolean state as to whether the module is installed (enabled) or not. At a guess, I would think that the value is possibly the weighting (a concept used for modules in Drupal 7). Would I be correct? Jul 25, 2017 at 15:51 -
3Yes, it is the weight. Note that comments on answers is not a good way to ask follow-up questions a year later. You should ask new questions and refer old related questions– BerdirJul 25, 2017 at 19:04