\Cake\ViewStringTemplateTrait

Adds string template functionality to any class by providing methods to load and parse string templates.

This trait requires the implementing class to provide a config() method for reading/updating templates. An implementation of this method is provided by Cake\Core\InstanceConfigTrait

Summary

Methods
Properties
Constants
setTemplates()
getTemplates()
templates()
formatTemplate()
templater()
No public properties found
No constants found
No protected methods found
$_templater
N/A
No private methods found
No private properties found
N/A

Properties

Methods

setTemplates()

setTemplates(array  $templates) : $this

Sets templates to use.

Parameters

array $templates

Templates to be added.

Returns

$this

getTemplates()

getTemplates(string|null  $template = null) : string|array

Gets templates to use or a specific template.

Parameters

string|null $template

String for reading a specific template, null for all.

Returns

string|array

templates()

templates(string|null|array  $templates = null) : $this|string|array

Gets/sets templates to use.

Parameters

string|null|array $templates

null or string allow reading templates. An array allows templates to be added.

Returns

$this|string|array

formatTemplate()

formatTemplate(string  $name, array  $data) : string

Formats a template string with $data

Parameters

string $name

The template name.

array $data

The data to insert.

Returns

string