Fr3nch13/CakePHP Utilities

Renderer
in package
uses ViewVarsTrait

Class for rendering email message.

Table of Contents

Constants

TEMPLATE_FOLDER  = 'email'
Constant for folder name containing email templates.

Properties

$_viewBuilder  : ViewBuilder|null
The view builder instance being used.

Methods

__clone()  : void
Clone ViewBuilder instance when renderer is cloned.
__construct()  : mixed
Constructor
createView()  : View
Constructs the view class instance based on the current configuration.
render()  : array<string, string>
Render text/HTML content.
reset()  : $this
Reset view builder to defaults.
set()  : $this
Saves a variable or an associative array of variables for use inside a template.
viewBuilder()  : ViewBuilder
Get the view builder being used.

Constants

TEMPLATE_FOLDER

Constant for folder name containing email templates.

public string TEMPLATE_FOLDER = 'email'

Properties

Methods

__clone()

Clone ViewBuilder instance when renderer is cloned.

public __clone() : void

__construct()

Constructor

public __construct() : mixed

createView()

Constructs the view class instance based on the current configuration.

public createView([string|null $viewClass = null ]) : View
Parameters
$viewClass : string|null = null

Optional namespaced class name of the View class to instantiate.

Tags
throws
MissingViewException

If view class was not found.

Return values
View

render()

Render text/HTML content.

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

If there is no template set, the $content will be returned in a hash of the specified content types for the email.

Parameters
$content : string

The content.

$types : array<string|int, string> = []

Content types to render. Valid array values are Message::MESSAGE_HTML, Message::MESSAGE_TEXT.

Tags
psalm-param

array<\Cake\Mailer\Message::MESSAGE_HTML|\Cake\Mailer\Message::MESSAGE_TEXT> $types

psalm-return

array{html?: string, text?: string}

Return values
array<string, string>

The rendered content with "html" and/or "text" keys.

reset()

Reset view builder to defaults.

public reset() : $this
Return values
$this

set()

Saves a variable or an associative array of variables for use inside a template.

public set(array<string|int, mixed>|string $name[, mixed $value = null ]) : $this
Parameters
$name : array<string|int, mixed>|string

A string or an array of data.

$value : mixed = null

Value in case $name is a string (which then works as the key). Unused if $name is an associative array, otherwise serves as the values to $name's keys.

Return values
$this

        
On this page

Search results