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).
  • In the policy edit form, pre-populate all the adjusters corresponding to required config and don't allow them to be removed.
  • If required config is missing then skip sending.

Remaining tasks

User interface changes

API changes

Data model changes

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

AdamPS created an issue. See original summary.

adamps’s picture

Version: 1.x-dev » 2.x-dev
Issue summary: View changes
adamps’s picture

Title: Add support for required adjusters » Add support for required config

adamps’s picture

Issue summary: View changes
Status: Active » Fixed

  • adamps committed 0d991b4b on 2.x
    Issue #3303340 by adamps: Add support for required config
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

drupgirl’s picture

Category: Feature request » Bug report

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)