Deprecate config_overlay_install_tasks_alter() and config_overlay_install_config_overlay()

Created on 8 May 2024, 8 months ago
Updated 13 May 2024, 7 months ago

Problem/Motivation

The documentation for config_overlay_install_tasks_alter() mentions module_load_install() which was removed in Drupal 10, see https://www.drupal.org/node/3220952

Proposed resolution

In addition to just replacing that one line with

  $moduleExtensionList = \Drupal::service('extension.list.module');
  assert($moduleExtensionList instanceof ModuleExtensionList);
  $modulePath = $moduleExtensionList->getPath('config_overlay');
  require_once \Drupal::root() . '/' . $modulePath . '/config_overlay.install';

we should maybe look into explaining that function a bit better. I just stumbled upon it and wasn't exactly sure whether or not I need it in my profile or not... ...which probably means no one else does either, which is not ideal.

Alternatively we could deprecate the function, if it is in fact not (or no longer) needed.

📌 Task
Status

Active

Version

2.0

Component

Code

Created by

🇩🇪Germany tstoeckler Essen, Germany

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @tstoeckler
  • 🇩🇪Germany tstoeckler Essen, Germany

    Ha, noticed that we cannot use ModuleHandlerInterface::loadInclude() as Config Overlay is not installed at that moment (inherently), so we need to manually require the file. Updated the issue summary...

  • 🇩🇪Germany tstoeckler Essen, Germany

    Hmm... yeah I think all of that stuff can be deprecated in favor of pointing people to 🐛 Dispatch config transformation event during site install from configuration Active if they encounter any installation issues.

    Tentatively renaming the issue...

  • 🇩🇪Germany tstoeckler Essen, Germany

    Really wavering back and forth on this one a bit...

    Tried what @bircher mentioned in the core issue in #5: To add the config overlay config transformer via settings.php. That's not super intuitive, though you need this whole things in your services.yml:

    services:
      # See config_overlay.services.yml
      config_overlay.extension_storage_factory:
        class: Drupal\config_overlay\Config\ExtensionStorageFactory
        arguments: ['@extension.list.profile']
      config_overlay.config_subscriber.transform_early:
        class: Drupal\config_overlay\EventSubscriber\ConfigTransformEarlySubscriber
        arguments:
          - '@extension.list.profile'
          - '%install_profile%'
          - '@config_overlay.extension_storage_factory'
          - '@config.storage'
        tags:
          - { name: event_subscriber }
    

    And then, because Config Overlay is not in the autoloader by default, the following in your project's composer.json:

        "autoload": {
            "classmap": [
                "web/modules/contrib/config_overlay/src/Config/ExtensionOptionalStorage.php",
                "web/modules/contrib/config_overlay/src/Config/ExtensionStorageFactory.php",
                "web/modules/contrib/config_overlay/src/Config/ReadOnlyUnionStorage.php",
                "web/modules/contrib/config_overlay/src/EventSubscriber/ConfigTransformEarlySubscriber.php",
                "web/modules/contrib/config_overlay/src/EventSubscriber/ConfigTransformSubscriberBase.php"
            ]
        },
    

    Not sure if there's a way we can tidy that up a bit, but not sure I want to actually recommend people doing so, as it seems like a lot of work...

Production build 0.71.5 2024