DefaultComposer
extends AutoService
in package
uses
IsActiveTrait
Class DefaultComposer
Tags
Table of Contents
Properties
- $active : bool
Methods
- createMailParams() : array<string|int, mixed>
- For a given task, prepare the mailing.
- createMessageTemplates() : array<string|int, mixed>
- Generate the message templates for use with token-processor.
- createTokenProcessorContext() : array<string|int, mixed>
- Define the contextual parameters for the token-processor.
- createTokenRowContext() : array<string|int, mixed>
- Create contextual data for a message recipient.
- isActive() : bool
- isClickTracking() : bool
- Determine whether to enable click-tracking.
- isSupported() : bool
- Determine whether this composer knows how to handle this mailing.
- onCompose() : mixed
- Given a mailing and a batch of recipients, prepare the individual messages (headers and body) for each.
- onRun() : mixed
- setActive() : $this
- applyClickTracking() : array<string|int, mixed>
- (Tentative) Alter hyperlinks to perform click-tracking.
Properties
$active
private
bool
$active
= TRUE
Methods
createMailParams()
For a given task, prepare the mailing.
public
createMailParams(ComposeBatchEvent $e, FlexMailerTask $task, TokenRow $row) : array<string|int, mixed>
Parameters
- $e : ComposeBatchEvent
- $task : FlexMailerTask
- $row : TokenRow
Tags
Return values
array<string|int, mixed> —A list of email parameters, such as "Subject", "text", and/or "html".
createMessageTemplates()
Generate the message templates for use with token-processor.
public
createMessageTemplates(ComposeBatchEvent $e) : array<string|int, mixed>
Parameters
- $e : ComposeBatchEvent
Return values
array<string|int, mixed> —A list of templates. Some combination of:
- subject: string
- html: string
- text: string
createTokenProcessorContext()
Define the contextual parameters for the token-processor.
public
createTokenProcessorContext(ComposeBatchEvent $e) : array<string|int, mixed>
Parameters
- $e : ComposeBatchEvent
Return values
array<string|int, mixed>createTokenRowContext()
Create contextual data for a message recipient.
public
createTokenRowContext(ComposeBatchEvent $e, FlexMailerTask $task) : array<string|int, mixed>
Parameters
- $e : ComposeBatchEvent
- $task : FlexMailerTask
Return values
array<string|int, mixed> —Contextual data describing the recipient.
Typical values are contactId
or mailingJobId
.
isActive()
public
isActive() : bool
Return values
boolisClickTracking()
Determine whether to enable click-tracking.
public
isClickTracking(ComposeBatchEvent $e) : bool
Parameters
- $e : ComposeBatchEvent
Return values
boolisSupported()
Determine whether this composer knows how to handle this mailing.
public
isSupported(CRM_Mailing_DAO_Mailing $mailing) : bool
Parameters
- $mailing : CRM_Mailing_DAO_Mailing
Return values
boolonCompose()
Given a mailing and a batch of recipients, prepare the individual messages (headers and body) for each.
public
onCompose(ComposeBatchEvent $e) : mixed
Parameters
- $e : ComposeBatchEvent
onRun()
public
onRun(RunEvent $e) : mixed
Parameters
- $e : RunEvent
setActive()
public
setActive(bool $active) : $this
Parameters
- $active : bool
Return values
$thisapplyClickTracking()
(Tentative) Alter hyperlinks to perform click-tracking.
protected
applyClickTracking(ComposeBatchEvent $e, array<string|int, mixed> $templates) : array<string|int, mixed>
This functionality probably belongs somewhere else. The current placement feels quirky, and it's hard to inspect via `cv debug:event-dispatcher', but it produces the expected interactions among tokens and click-tracking.
Parameters
- $e : ComposeBatchEvent
- $templates : array<string|int, mixed>
Return values
array<string|int, mixed> —Updated templates.