ViewVarsTrait
Provides the set() method for collecting template context.
Once collected context data can be passed to another object. This is done in Controller, TemplateTask and View for example.
Table of Contents
Properties
- $_viewBuilder : ViewBuilder|null
- The view builder instance being used.
Methods
- createView() : View
- Constructs the view class instance based on the current configuration.
- set() : $this
- Saves a variable or an associative array of variables for use inside a template.
- viewBuilder() : ViewBuilder
- Get the view builder being used.
Properties
$_viewBuilder
The view builder instance being used.
protected
ViewBuilder|null
$_viewBuilder
Methods
createView()
Constructs the view class instance based on the current configuration.
public
createView([string|null $viewClass = null ]) : View
Parameters
- $viewClass : string|null = null
-
Optional namespaced class name of the View class to instantiate.
Tags
Return values
Viewset()
Saves a variable or an associative array of variables for use inside a template.
public
set(array<string|int, mixed>|string $name[, mixed $value = null ]) : $this
Parameters
- $name : array<string|int, mixed>|string
-
A string or an array of data.
- $value : mixed = null
-
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.
Return values
$thisviewBuilder()
Get the view builder being used.
public
viewBuilder() : ViewBuilder