TemplateAwareMailerTrait uses \Cake\ORM\Locator\LocatorAwareTrait
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
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 database template for current mailer and action
- renderFromDb() : array<string|int, mixed>
- Render email from database 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|nullgetDbTemplate()
Get database template for current mailer and action
protected
getDbTemplate() : EmailTemplate|null
Return values
EmailTemplate|nullrenderFromDb()
Render email from database template
protected
renderFromDb(EmailTemplate $template[, string $content = '' ]) : array<string|int, mixed>
Parameters
- $template : EmailTemplate
-
Database template
- $content : string = ''
-
Fallback content