W3cubDocs

/CakePHP 4.1

Class Renderer

Class for rendering email message.

Namespace: Cake\Mailer

Constants summary

  • string
    TEMPLATE_FOLDER
    'email'

Properties summary

  • $_viewBuilder protected
    \Cake\View\ViewBuilder|null

    The view builder instance being used.

Method Summary

  • __clone() public

    Clone ViewBuilder instance when renderer is cloned.

  • __construct() public

    Constructor

  • createView() public

    Constructs the view class instance based on the current configuration.

  • render() public

    Render text/HTML content.

  • reset() public

    Reset view builder to defaults.

  • set() public

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

  • viewBuilder() public

    Get the view builder being used.

Method Detail

__clone() public

__clone()

Clone ViewBuilder instance when renderer is cloned.

__construct() public

__construct()

Constructor

createView() public

createView(?string $viewClass)

Constructs the view class instance based on the current configuration.

Parameters

string|null $viewClass optional

Optional namespaced class name of the View class to instantiate.

Returns

\Cake\View\View

Throws

Cake\View\Exception\MissingViewException
If view class was not found.

render() public

render(string $content, array $types)

Render text/HTML content.

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

Parameters

string $content

The content.

string[] $types optional

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

Returns

array

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

reset() public

reset()

Reset view builder to defaults.

Returns

$this

set() public

set(mixed $name, mixed $value)

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

Parameters

string|array $name

A string or an array of data.

mixed $value optional

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.

Returns

$this

viewBuilder() public

viewBuilder()

Get the view builder being used.

Returns

\Cake\View\ViewBuilder

Property Detail

$_viewBuilder protected

The view builder instance being used.

Type

\Cake\View\ViewBuilder|null

© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.1/class-Cake.Mailer.Renderer.html