KMP PHP API Reference

TemplateAwareMailerTrait

Trait for using database-stored email templates

This trait intercepts the email rendering pipeline to use database templates when available, falling back to file-based templates if not found.

Table of Contents

Properties

$_preloadedTemplate  : EmailTemplate|null
Pre-loaded template for generic workflow emails.

Methods

render()  : array<string|int, mixed>
Override the render method to use database templates
getCurrentAction()  : string|null
Get the current action being called This is determined by looking at the backtrace
getDbTemplate()  : EmailTemplate|null
Get the preloaded database template for slug-based sending.
renderFromDb()  : array<string|int, mixed>
Render email from database template

Properties

$_preloadedTemplate

Pre-loaded template for generic workflow emails.

protected EmailTemplate|null $_preloadedTemplate = null

When set, render() uses this DB template instead of the file-based template.

Methods

render()

Override the render method to use database templates

public render([string $content = '' ]) : array<string|int, mixed>
Parameters
$content : string = ''

Content

Return values
array<string|int, mixed>

getCurrentAction()

Get the current action being called This is determined by looking at the backtrace

protected getCurrentAction() : string|null
Return values
string|null

renderFromDb()

Render email from database template

protected renderFromDb(EmailTemplate $template[, string $content = '' ]) : array<string|int, mixed>
Parameters
$template : EmailTemplate

Database template

$content : string = ''

Fallback content

Return values
array<string|int, mixed>
On this page

Search results