Problem/Motivation
In Drupal 11.3, field.storage.node.body was moved out of the Node module into a new node_storage_body_field sub-module (#3447617).
Contributed modules that ship node types with a body field must now declare a dependency on node_storage_body_field to ensure the field storage
config exists when their module is installed. However, adding this dependency breaks installation on Drupal 10.x and 11.0–11.2, where the sub-module does not
exist.
Moving field.storage.node.body to config/optional does not work reliably. Drupal's
ConfigInstaller::checkConfigurationToInstall() validates all config/install dependencies for all modules being installed in a single operation — including during install profile execution and drush en with dependencies. Optional config is either deferred (during profile install) or only processed after all config/install is validated, causing UnmetDependenciesException failures.
Steps to reproduce
- Have a contributed module that ships a node type with a body field (e.g.
field.storage.node.bodyinconfig/install). - Add
node_storage_body_field:node_storage_body_fieldas a dependency in the module's.info.ymlto support Drupal 11.3. - Attempt to install the module on Drupal 10.x or 11.0–11.2 — installation fails because
node_storage_body_fielddoes not exist. - Alternatively, move
field.storage.node.bodytoconfig/optionaland attempt to install the module as part of a profile or via
drush enwith dependencies — installation fails withUnmetDependenciesException.
Proposed resolution
Create a forward-compatibility polyfill module (drupal/backport_node_storage_body_field) with two major versions:
- 1.x (Drupal 10.x / 11.0–11.2): Provides a minimal
node_storage_body_fieldmodule that shipsfield.storage.node.body
in itsconfig/install, mirroring the behavior of the core sub-module added in 11.3. - 2.x (Drupal 11.3+): Empty metapackage. Core already provides
node_storage_body_field, so this package is a no-op.
Contributed modules can then:
- Add
"drupal/backport_node_storage_body_field": "^1 || ^2"to theircomposer.json. - Add
node_storage_body_field:node_storage_body_fieldto their.info.ymldependencies. - Remove
field.storage.node.bodyfrom their ownconfig/install.
Remaining tasks
- Create the 1.x branch with the polyfill module and
field.storage.node.bodyconfig. - Create the 2.x branch with the metapackage.
- Tag initial releases.
- Update consuming modules to use the polyfill.
User interface changes
None.
API changes
None.
Data model changes
None. The polyfill provides the same field.storage.node.body config that core's node_storage_body_field sub-module provides in 11.3.
Issue fork backport_node_storage_body_field-3577999
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
joevagyok commentedComment #7
joevagyok commented