I have created an sample installation profile (based on one that I grabbed from the Acqua Drupal install profiles. Thus far I understand the basic architecture. I add dependancies, but I cant figure out how to enable the modules. For instance, I want to require views, views_ui, and features, and I want those modules to be automatically enabled when I install the profile. I'm assuming I add code somewhere in my .install file within the profile. Can someone give me an example of how I would require and enable views for instance?
1 Answer
You need to add them as dependencies
in the .info file. To take a segment from standard.info:
dependencies[] = block
dependencies[] = color
dependencies[] = comment
dependencies[] = contextual
dependencies[] = dashboard
To add a little reference from How to Write a Drupal 7 Installation Profile:
The contents of the profilename.info file are as follows:
- The name, description, and core assignments are all required.
- The dependencies list includes all modules that will be enabled when this profile is installed (the ones above are the defaults from the Standard install profile).
- You can optionally include other declarations that can also appear in module .info files.
(Emphasis mine).
So enabling views would just be:
dependencies[] = views
And if you want the UI:
dependencies[] = views_ui
-
I added both views and views_ui in that fashion, however, when I install the new profile, the modules are disabled by default, perhaps I'm missing something? Commented Dec 3, 2012 at 18:30
-
Might be a daft question but is the views module available during the install? And where's it located?– Clive ♦Commented Dec 3, 2012 at 18:32
-
2@Clives answer is correct. If you have added the modules as dependencies, they will be enabled, and if they are not present, the install will fail and abort. To test that your doing the right thing, add a bogus dep,
dependencies[] = BLARGH!
. If that doesn't cause the install to fail and complain about missing moduleBLARGH!
, you're editing the wrong file. Commented Dec 3, 2012 at 18:49 -
Sorry, I spoke to soon, it did indeed work, I forgot to mention I was using Aegir, I forgot to re-verify the Platform after I changed the install profile, thanks for help Commented Dec 3, 2012 at 20:59