Trait StringTemplateTrait
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
Namespace: Cake\View
Property Summary
-
$_templater protected
Cake\View\StringTemplate
StringTemplate instance.
Method Summary
-
formatTemplate() public
Format a template string with $data
-
templater() public
templater
-
templates() public
Get/set templates to use.
Method Detail
formatTemplate() ¶ public
formatTemplate(string $name, array $data): string
Format a template string with $data
Parameters
-
string
$name The template name.
-
array
$data The data to insert.
Returns
string
templater() ¶ public
templater(): Cake\View\StringTemplate
templater
Returns
Cake\View\StringTemplate
templates() ¶ public
templates(string|null|array $templates = null): $this|string|array
Get/set templates to use.
Parameters
-
string|null|array
$templates optional null or string allow reading templates. An array allows templates to be added.
Returns
$this|string|array