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?
I keep a text file listing modules I want enabled modules and "drush en" that file on deployment.– JonathanSep 18, 2016 at 10:20
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
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. for
redirectI can see that it is enabled, and in
core.extension.ymlit's corresponding entry is
redirect: 0So it can't be a boolean for installed state. Jul 25, 2017 at 15:48
2Secondly, the entry in
core.extension.ymlfor paragraphs module I have on my site is:
paragraphs: 11i.e. not the value of 'one' but 'eleven'. So 2 things to conclude: 1) The module just has to be present in
core.extension.ymlto 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