Problem/Motivation

This issue mostly affects developers.

  1. The "phases" of email processing are not that clear.
  2. The requirements of what can be done in each phase are a bit muddled.
  3. The email processors and hooks are a bit confusing and rigid.

Proposed resolution

  1. Add constants for the phases on EmailInterface with clear descriptions.
  2. Adjust the set of phases.
    • Init is to set processors and change parameters.
    • Build is before the "switching" of language/theme/account, must not trigger rendering in this phase.
    • PreRender is after the switching and before rendering (rarely needed).
    • PostRender after rendering
  3. Change Email::addProcessor to accept a simple callable giving greater flexibility and simplicity.

Remaining tasks

User interface changes

API changes

  • Most implementations of EmailProcessorInterface::preRender() should change to use EmailProcessorInterface::build(). However could will mostly still work if no change is made.
  • Removed hook_mailer_pre_build(), hook_mailer_pre_render(), hook_mailer_post_render(). Instead use hook_mailer_init() and call $email->processor() registering your callable.
  • EmailInterface::addProcessor() changed to support the above. It's more flexible allowing any weight, any callable.
  • New function EmailProcessorInterface::initialize() changed, but classes derived from EmailProcessorBase are unaffected so it's unlikely to affect anyone.

Data model changes

Comments

AdamPS created an issue. See original summary.

adamps’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new41.92 KB
adamps’s picture

Issue summary: View changes
adamps’s picture

Issue summary: View changes

  • AdamPS committed f4eb87d on 1.x
    Issue #3275310 by AdamPS: Improvements to phases and processors
    
adamps’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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