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
Cake\View\StringTemplate|null
StringTemplate instance.
Formats a template string with $data
Gets templates to use or a specific template.
Sets templates to use.
Returns the templater instance.
formatTemplate(string $name, array<string, mixed> $data): string
Formats a template string with $data
string
$name The template name.
array<string, mixed>
$data The data to insert.
string
getTemplates(string|null $template = null): array|string
Gets templates to use or a specific template.
string|null
$template optional String for reading a specific template, null for all.
array|string
setTemplates(array<string> $templates): $this
Sets templates to use.
array<string>
$templates Templates to be added.
$this
templater(): Cake\View\StringTemplate
Returns the templater instance.
Cake\View\StringTemplate
StringTemplate instance.
Cake\View\StringTemplate|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.4/trait-Cake.View.StringTemplateTrait.html