Information for: DEVELOPERS   PARTNERS

Creating a custom profile with Acquia CMS component modules

Introduction to custom profiles

You can create your own profile to use a subset of Acquia CMS functionality.

The following use cases might lead to the creation and use of a custom profile:

  • You want to limit your use of the features of Acquia CMS or customize for your requirements.
  • You want to focus on the content-specific features of Acquia CMS and build extended modules or features to add to those features.
  • You want to add or remove installation-specific tasks from the standard Acquia CMS profile.
  • You may have a specific requirement utilizing only a single module from Acquia CMS’s standard profile, such as acquia_cms_article, with multiple contributed modules, such as google_analytics.

With custom profiles, you do not need to install the entire Acquia CMS profile to use only a single Acquia CMS module, or specific features.

Creating a profile directory and the required files

The first step for creating a custom profile is to create a directory for the custom profile and the required files. To create a custom profile and the required files, do this:

  1. At the /profiles/custom location of the project, create a custom profile directory with the name starter, assuming the name of the custom profile as “Starter,”.
  2. In the Starter directory, include the starter.info.yml file, resulting in the directory appearing as /profiles/custom/starter/starter.info.yml.

In the starter directory, you may optionally include the following:

  • starter.install
  • starter.profile
  • /config
  • /translations

Note

In your profile, if you include an .install file that implements hook_install(), installation from configuration is not supported. For more information about installing from configuration, see the documentation on Drupal.org.

Using Acquia CMS component modules

You can include the Acquia CMS component modules you require in the custom profile you created. It helps you to:

  • Avoid installing Acquia CMS features that are not relevant to your business needs.
  • Focus on the features required for your project. Using fewer modules helps reduce the time and effort required to develop and test new features.

The following are ways to include a subset of the available modules in your custom profile:

  • Edit the composer.json file available on the top level directory of your project to require only the modules that are needed in the custom profile. Alternatively, if composer is not installed, run the composer command php composer.phar require.
  • If composer is installed, run the composer require vendor/package command to fetch the module.

For example, assume that your business requirements for managing and extending the Article content type match what is being offered by Acquia CMS with no changes required.

You can use the Acquia CMS article module by mentioning the module in the composer.json file, or run the command composer require drupal/acquia_cms_article:^1.0 to fetch the module.

To use other modules, specify the modules you need in the require sections. Also:

  • To install a specific version of a module, include both the module and its version in the require section of composer.json. If you indicate a module version, this is the version that will be included. If not, it will take the most recent version that is at least as current as the version indicated.
  • You can add or remove the contributed modules from the require section of composer.json as needed.

For example:

"require": {
  "acquia/memcache-settings": "^1",
  "cweagans/composer-patches": "^1.7",
  "drupal/acquia_cms_article": "^1.0"
}

Installing the required modules upon profile installation

After specifying the modules you want to include in your custom profile, you can force the module installation when your custom profile is installed. To do this, add the module’s machine name inside the install: key of your starter.info.yml file. You can use the code example below and adjust it based on your needs:

name: Starter
type: profile
description: 'A custom profile to demonstrate the use of Acquia CMS component modules..'
core_version_requirement: '^9'

# Your Custom list of modules. You may remove Acquia CMS component modules and
# add or remove other modules here as necessary for your custom profile.

install:

# Core Modules
- node
- block
- taxonomy
- bigpipe
- block_content

 # Contributed Modules
- json_api
- webform

 # Acquia CMS modules
- acquia_cms_article
- acquia_cms_search

theme:

 # Core themes
- olivero
- seven

Required configurations for themes

In addition to specific modules, you may want to include configuration related to the theme you are using. To do this, set up your system.theme.yml and node.settings.yml files.

For example:

config/install/system.theme.yml
 admin: seven
 default: olivero

config/install/node.settings.yml
  use_admin_theme: true