TplContext
in package
implements
Stringable
Provides a wrapper of Twig\TemplateWrapper.
Table of Contents
Interfaces
- Stringable
Methods
- __toString() : string
- Renders the template to a string.
- getWrapper() : TemplateWrapper
- Returns the underlying wrapper instance.
- render() : string
- Renders the template to a string, taking additional variables that are not commit to local set.
- setVar() : void
- Sets a local variable.
- setVars() : void
- Merges a set of variables into the local variable set.
Methods
__toString()
Renders the template to a string.
public
__toString() : string
Return values
string —Rendered template.
getWrapper()
Returns the underlying wrapper instance.
public
getWrapper() : TemplateWrapper
Return values
TemplateWrapperrender()
Renders the template to a string, taking additional variables that are not commit to local set.
public
render([array<string, mixed>|null $vars = null ]) : string
Parameters
- $vars : array<string, mixed>|null = null
-
Additional local variables, nullable to avoid additional function calls.
Return values
string —Rendered template.
setVar()
Sets a local variable.
public
setVar(string $path, mixed $value) : void
$path is evaluated to allow accessing deeper layer arrays without overwriting it entirely.
Parameters
- $path : string
-
Array path to the variable.
- $value : mixed
-
Desired value.
setVars()
Merges a set of variables into the local variable set.
public
setVars(array<string, mixed> $vars) : void
Parameters
- $vars : array<string, mixed>
-
Variables to apply to the set.