我已经创建了一个示例安装配置文件（基于我从Acqua Drupal Install型材抓取的安装配置文件。到目前为止，我理解基本架构。我添加依赖，但我无法弄清楚如何启用模块。例如，我想需要视图，查看_UI和功能，并且我希望在安装配置文件时要自动启用这些模块。我假设我在配置文件中添加了我的.install文件中的代码。有人可以给我一个例子我如何要求和启用视图？
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?
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.
So enabling views would just be:
dependencies = views
And if you want the UI:
dependencies = views_ui