Acquia Lightning allows you to create sub-profiles that are based on the default Acquia Lightning distribution profile. Making a sub-profile enables you to customize the installation process to meet your specific needs.
Circumstances where creating a sub-profile of Acquia Lightning would be of benefit include the following situations:
lightning.extend.yml
to accomplish any of the
previously items.To create an Acquia Lightning sub-profile, use one of the following methods:
For uncomplicated use cases, such as excluding some Acquia Lightning components or including a few of your own, you can use the sub-profile generator.
Note
The generator is also a good starting point for more complex sub-profiles.
Requirements
To run the sub-profile generator, ensure that you have the following items for your application:
Running the generator
After you ensure that your application meets the previous requirements, run the following command from your installation’s docroot directory:
drupal lightning:subprofile
lightning.extend.yml
to a sub-profile¶If you previously used the Acquia Lightning extend file
(lightning.extend.yml
), you can also convert the file to a sub-profile.
Requirements
To run the conversion, your application requires the following items:
Running the conversion
To convert the file, run the following command from your installation’s docroot directory:
./vendor/bin/lightning-subprofile /path/to/your/extend/file/lightning.extend.yml
To switch an existing site’s install profile from Acquia Lightning to a sub-profile, complete the following steps:
Edit the settings.php
.
In the file, add or update the install_profile
:
$settings['install_profile'] = '[SUB-PROFILE_NAME]';
Run the following command to enable the profile:
drush cset core.extension module.[SUB-PROFILE_NAME] 0
If you use CMI or have exported the core.extension.yml
, export the
updated extension listing to a file.
lightning.extend.yml
file¶Versions of Acquia Lightning prior to version 8.x-2.0.5 included the
lightning.extend.yml
file, and installed modules in the following order:
These previous versions installed extend modules to list them in the extend file.
As of version 2.0.5, Acquia Lightning defers to the core install system to
determine when to install modules. With this change, you can’t rely on
Acquia Lightning to install all modules by the time you install all your
additional dependencies. By design, Acquia Lightning does not install
optional configurations until the end of the installation process. Any attempt
to modify optional configurations must occur with hook_ENTITY_presave
rather than hook_install
or similar.
If this causes problems during your installation, one resolution method is to
remove the dependencies from your subprofile.info.yml
file, and then move
those dependencies into an install hook in your sub-profile’s install file.
For example:
$modules = [
'mymodule',
'foo',
'bar',
// ...
];
foreach ($modules as $module) {
\Drupal::service('module_installer')->install([$module]);
}