Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bootstrap 5.5.4 — Minor update available for module views_bootstrap (5.5.4). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: Opensolr Search 5.1.3 — Minor update available for module opensolr_search (5.1.3). Release: ServiceM8 Webform Integration 1.2.1 — Minor update available for module servicem8_webform (1.2.1). Release: PostfixAdmin 1.0.0 — Initial release available for module postfix_admin (1.0.0)! Release: ip_analyser 1.0.3 — Minor update available for module ip_analyser (1.0.3). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

Purpose

As you may know, Drupal Core allows installation profiles to provide configurations that override default config provided by core and other modules. Unfortunately, other modules -- even sub-modules of the installation profile -- are not afforded the same capability. As a result, it is difficult for installation profile maintainers to accomplish in Drupal 8/9 what was possible with the Features module in Drupal 7 -- the ability to break up config into logical sub-modules.

Another place where Core's default behavior is problematic is optional sub-modules -- an installation profile can only override config one time, at profile install time. If you want to provide functionality in your installation profile that may not be needed on all deployments (e.g. a feature that an admin can opt out of enabling during site install), you normally don't have a way to override the config that such a feature requires. In order to accomplish this, you'd need a way to put the config for that feature into the feature itself but Drupal Core won't allow two modules to provide the same configs. If you pre-install the config at profile level, then you will run into errors when the module that actually needs that config gets installed.

This module fixes both of the limitations mentioned above. It allows modules to provide configurations that override the default configurations provided by other modules. It accomplishes this by allowing such a module to implement a hook to declare which config(s) it is providing that should be allowed to override configuration that already exists on the site.

It's important to stress that this module is intended only for use by installation profiles. It should most certainly not be used as a dependency of other contrib. modules, since that introduces the messy potential for multiple contrib. modules to override each other's configs (e.g. what if 3 contrib modules overrode comment.settings.yml -- which would be expected to win?).

How to Use

  1. Install the install_config_override module through Composer.
  2. Add the install_config_override module as a dependency of the installation profile or whichever sub-module(s) in the installation profile need to override config.
  3. Within each profile sub-module that provides config that overrides default config of other modules, implement hook_install_config_overrides() so that it returns the machine name of each config that is being overridden.
  4. Install the profile and sub-modules as normal. hook_install_config_overrides() takes effect for both sub-modules installed during site install (i.e., sub-modules required as dependencies of the profile), as well as for sub-modules installed manually after site installation (i.e., optional features/dependencies of the profile).

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Feb 2024
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Dormant

Releases

Version Type Core Release date
2.0.0-beta1 Pre-release Feb 23, 2024
2.x-dev Dev Feb 23, 2024