Add support for required adjusters

Created on 12 August 2022, about 3 years ago
Updated 13 June 2025, 3 months ago

Problem/Motivation

The Mailer attribute can set common_adjusters which are given priority in the GUI. This can be a useful hint, but actually we are much more interested in knowing which settings are required. We can then generate an error message if they are missing. Examples:

  • 'To' on contact form
  • 'Body' and 'Subject' on user emails

Proposed resolution

  • Change common_adjusters to required_config. Remove any specific values from the Mailer classes in this module that are recommended but not required (there aren't many cases).
  • Change the values from "email_XXX" to just "XXX", e.g. "subject" or "body".
  • In the policy edit form, pre-populate all the adjusters corresponding to required config and don't allow them to be removed.

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom adamps

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¬πŸ‡§United Kingdom adamps
  • πŸ‡¬πŸ‡§United Kingdom adamps
  • @adamps opened merge request.
  • πŸ‡¬πŸ‡§United Kingdom adamps
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed 20 days ago
  • πŸ‡ΊπŸ‡ΈUnited States drupgirl

    Great feature. I need some help getting it to work.

    Core 10.5
    DSM+ 2.x-dev

    When I enable symfony_mailer, mailer_policy & mailer_override and go to mailer policy page this warning appears:

    Warning: Undefined array key "required_config" in Drupal\mailer_policy\Form\PolicyEditForm->form() (line 40 of modules/contrib/symfony_mailer/modules/mailer_policy/src/Form/PolicyEditForm.php).
    Drupal\mailer_policy\Form\PolicyEditForm->form() (Line: 107)

    If I delete the *All* default policy and try to add one then this error appears:

    TypeError: array_diff(): Argument #1 ($array) must be of type array, null given in array_diff() (line 40 of modules/contrib/symfony_mailer/modules/mailer_policy/src/Form/PolicyEditForm.php).
    Drupal\mailer_policy\Form\PolicyEditForm->form(Array, Object) (Line: 107)
    Drupal\Core\Entity\EntityForm->buildForm(Array, Object)

Production build 0.71.5 2024