Allow builders to provide default values for adjusters

Created on 31 July 2025, about 1 month ago

Problem/Motivation

Currently, setting up policies is somewhat difficult if they don't already exist because everything starts off empty. For new modules that natively implement this module I would imagine they install the configurations. But if they are accidentally deleted you start from scratch. If imported like the User module then you lose all of your changes if you import them again.

Steps to reproduce

-

Proposed resolution

Allow builders to offer default configuration to the adjusters. For example, legacy builder could provide default subject and body values based on the legacy entries for those. This would make changing those emails much easier as you'll see the existing content when you add the policy and then be able to adjust it.

It potentially would mean the "import" is not needed anymore because you just create the policy for the emails you want and it provides the same effect as importing, in essence granular import. Import likely still useful though for initial setup.

Additionally, by having these defaults in place, it would allow a non-legacy builder to provide HTML defaults for emails without needing a policy, where currently when I have been looking to implement this it appears like there's no straight forward way for a developer to provide default HTML for an email that is sent directly using Level 3 direct integration, and if you do find a way it doesn't expose it to an editor to allow them to use it as a baseline.

Maybe I'm missing something and in which case maybe there's some documentation I can help improve.

Remaining tasks

-

User interface changes

-

API changes

-

Data model changes

-

Feature request
Status

Active

Version

2.0

Component

Policy

Created by

🇬🇧United Kingdom Driskell

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

Comments & Activities

  • Issue created by @Driskell
  • 🇬🇧United Kingdom adamps

    "Import" converts the current site config to the new format, which is quite a different thing from a default. If you want the defaults then you should do "enable" (without importing), or "reset". All of that is part of the "mailer override" module, which is for optionally replacing the implementations of legacy mail implementations from other modules (so yes it's non-standard, it was tricky).

    If imported like the User module then you lose all of your changes if you import them again.

    True, and it gives a clear warning. How else could it be? I am not a magician😃.

    ===

    If you are writing a new mailer, then ignore all the above. You can just provide a straightforward default in config/install directory. Then you could compare/reset it in the usual way with the config update module. This seems to be exactly inline with how config works in other parts of Drupal. Does that answer your question?

    You could also hardcode a value into your code. It could still be overridden in the UI, but the UI wouldn't see the value from code. So maybe this what you tried that wasn't working?

  • 🇬🇧United Kingdom adamps
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024