warn/enforce on config save for the owner prefix of config being an installed extension

Created on 16 June 2025, 16 days ago

Problem/Motivation

Drupal\Core\EventSubscriber\ConfigImportSubscriber checks the prefix of config on import, and enforces that it is the name of an enabled extension:

      [$owner] = explode('.', $name, 2);
      if ($owner !== 'core') {
        $message = FALSE;
        if (!isset($core_extension['module'][$owner]) && isset($module_data[$owner])) {
          $message = $this->t('Configuration %name depends on the %owner module that will not be installed after import.', [

However, there is no similar control on saving config -- and up until I fixed it today, the documentation on config ( https://www.drupal.org/docs/develop/creating-modules/defining-and-using-... ) said that using the module name as a prefix was only a suggestion.

This means that a module developer could create config that can't be deployed or imported:

1. Write an admin settings page in their module, saving the config in a name like substring_of_module_name.settings
2. Do a config export
3. Deploy the code to a different environment
4. Config import fails because substring_of_module_name doesn't exist

Steps to reproduce

Proposed resolution

Warn developers when config is being saved that the name is incorrectly formed if the prefix is not the name of an installed extension.

Upgrade this to an exception in the next major.

@alexpott on Slack:

> We could start with a warning - and add it to an event subscriber… either in core or maybe in \Drupal\system\SystemConfigSubscriber::onConfigSave

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component

configuration system

Created by

🇬🇧United Kingdom joachim

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

Comments & Activities

Production build 0.71.5 2024