Problem/Motivation

Code that already has a Config or ImmutableConfig object still needs the TypedConfigManager to obtain its typed data:

$typed_config = $this->typedConfigManager->createFromNameAndData($config->getName(), $config->getRawData());

The same tedious operation is repeated in several places, including ConfigFormBase, ConfigActionManager and RecipeConfigInstaller. Some callers also need to obtain or inject the manager only for this purpose.

Configuration objects already create a typed data representation internally through the protected getSchemaWrapper() method. Callers however can't request this directly from the configuration object and must instead obtain the TypedConfigManager themselves.

Background

#2130811: Use config schema in saving and validating configuration form to ensure data is consistent and correct kept configuration schema methods protected, leaving public access open for later.

In #2300677: JSON:API POST/PATCH support for fully validatable config entities, exposing getSchemaWrapper() was considered. #2869809: Make it easy to get typed config representations of entities provided createFromNameAndData() instead.

This task came up in #3634663: Changing the human-readable label of any entity bundle with machine name 'default' overrides the 'default' string globally across Views UI tabs and configuration entities. and is being split off here.

Proposed resolution

Add StorableConfigBase::getTypedData() and update applicable callers:

$typed_config = $config->getTypedData();

The chosen name follows the existing EntityInterface::getTypedData() API.

Return an independent typed data snapshot of the current raw configuration, including unsaved changes and excluding runtime overrides. Reuse existing internals where appropriate.

Keep createFromNameAndData() for callers working with separate names and data arrays.

Follow-up cleanup

Once callers use getTypedData(), several classes no longer need their own typed configuration manager. The follow-up commit deprecates those constructor arguments, the corresponding protected properties, and ConfigFormBase::typedConfigManager(). It also deprecates two dependencies that were already unused: the router builder in MenuLinksetSettingsForm and the role storage in AccountSettingsForm.

Core uses the shorter constructor calls. During the transition, the affected form factories continue to pass the original arguments to subclasses that rely on them. The service property deprecations build on #3635170: Allow DeprecatedServicePropertyTrait to specify Drupal versions.

Remaining tasks

Postponed on #3519400: Update DeprecatedServicePropertyTrait for Drupal 12+

Review.

User interface changes

None.

Introduced terminology

None.

API changes

Configuration objects extending StorableConfigBase gain a public getTypedData() method.

TypedConfigManager's existing API remains unchanged.

Follow-up cleanup

Also, the following dependencies and accessor are deprecated and scheduled for removal in Drupal 13:

  • The typed configuration manager constructor argument ($typedConfig, $typed_config_manager, or $typedConfigManager) in ConfigActionManager, ConfigFormBase, ConfigTranslationFormBase, NegotiationBrowserForm, NegotiationConfigureForm, NegotiationUrlForm, LocaleSettingsForm, MediaSettingsForm, Drupal\navigation\Form\SettingsForm, CronForm, FileSystemForm, ImageToolkitForm, MenuLinksetSettingsForm, PerformanceForm, RegionalForm, SiteInformationForm, SiteMaintenanceModeForm, ThemeSettingsForm, and AccountSettingsForm, together with the corresponding protected properties and ConfigFormBase::typedConfigManager().
  • The already unused $routerBuilder constructor argument and protected property in MenuLinksetSettingsForm.
  • The already unused $roleStorage constructor argument and protected property in AccountSettingsForm.

Data model changes

None.

Release notes snippet

Configuration objects now provide getTypedData() to obtain typed data directly from their current raw configuration values.

Redundant typed configuration manager dependencies and two previously unused form dependencies are deprecated and scheduled for removal in Drupal 13.

Disclosure

In accordance with the project’s AI policy, the author discloses that this issue summary's draft was developed, revised and copyedited with AI assistance. The author, however, meticulously reworked the draft sentence by sentence and often word by word, rather than merely reviewing it, then finalized and posted it, and takes pride in its content and full responsibility for its all-too-human imperfections. A certain fondness for detail is the author’s own indulgence, as is the author's personal faible for dashes and consistent use of the <code> tag.

Issue fork drupal-3635030

Command icon 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

pancho created an issue. See original summary.

pancho’s picture

Status: Active » Needs review
Issue tags: +Needs followup
Related issues: +#3635170: Allow DeprecatedServicePropertyTrait to specify Drupal versions
pancho’s picture

Issue summary: View changes
needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new91 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

pancho’s picture

Status: Needs work » Needs review

Rebase after #3278431: [November 2026] Use PHP 8 constructor property promotion for existing code.

Unfortunately some constructor property promotions have to be reversed to allow for a proper BC path. Also, some property renames had to be reversed to make sure we're following the expected codestyle.

Ready for review again.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new98 bytes

The Needs Review Queue Bot tested this issue. The merge request has merge conflicts and cannot be merged. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

pancho’s picture

Title: Add getTypedData() to configuration objects » [PP-1] Add getTypedData() to configuration objects
Issue summary: View changes
Status: Needs work » Postponed
Issue tags: -Needs change record, -Needs followup
Related issues: +#3519400: Update DeprecatedServicePropertyTrait for Drupal 12+

Merged current main and added a CR draft, but postponing this one on #3519400: Update DeprecatedServicePropertyTrait for Drupal 12+ for now.