Fr3nch13/CakePHP Utilities

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

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
throws
MissingViewException

If view class was not found.

Return values
View

set()

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
$this

        
On this page

Search results