From the previous article the web developers got to know how to create install profiles for Drupal 6. In this article we will elaborate on creating install profile for Drupal 7, the newest updates to the program and consider the relevant examples.
The profile structure is the following:
- my_profile
- libraries
- modules
- my_profile.info
- my_profile.install
- my_profile.profile
As we can see from the above-mentioned structure, as opposed to Drupal 6, install profile in Drupal 7 resembles a module (with its .info and .*install files).
Important: because install profile is more like a module now, the folder in which it'll be placed, must have the same name as the profile name. In this case my_profile.
Now we are going to investigate step by step, how each of the files in the installation profile is being created.
1. Creating .info.
This file is similar to .info file of any module.
Below follows the example of my_profile.info
php ; $Id$ name = My Profile description = Install My profile. version = VERSION core = 7.x dependencies[] = block dependencies[] = color dependencies[] = comment dependencies[] = contextual dependencies[] = dashboard dependencies[] = dblog dependencies[] = field dependencies[] = field_sql_storage dependencies[] = field_ui dependencies[] = filter dependencies[] = image dependencies[] = list dependencies[] = menu dependencies[] = node dependencies[] = number dependencies[] = options dependencies[] = overlay dependencies[] = path dependencies[] = php dependencies[] = rdf dependencies[] = search dependencies[] = shortcut dependencies[] = system dependencies[] = taxonomy dependencies[] = simpletest dependencies[] = text dependencies[] = user dependencies[] = field_group dependencies[] = flag dependencies[] = flag_actions dependencies[] = rules dependencies[] = rules_admin dependencies[] = wysiwyg files[] = my_profile.profile
There is not much novelty in the creation procedure in the first 4 lines.
name - profile name that will be shown in the list of available install profiles.
description - the description that will be shown under profile name.
dependencies - array of names of modules that must be enabled during installation process.
The above allows for the simpler indication of required modules for there is no need now to secure the strict order for the modules like it was in Drupal 6 where the main modules had to be described first and the dependant ones were to follow.
files - full file name of install profile. In this case my_profile.profile.
2. Creating .profile.
In Drupal 7 this file doesn't perform the role of the main function as it happened in Drupal 6. Now it is specifying the name for the site My profile. But it's necessary to have this file in the install profile.
php // $Id$ /** * Implements hook_form_alter(). * * Allows the profile to alter the site configuration form. */ function my_profile_form_install_configure_form_alter(&$form, $form_state) { // Set a default name for the dev site. $form['site_information']['site_name']['#default_value'] = t('My Profile'); }