ViewRenderer
in
An interface defining a ViewRenderer ViewRenderers are utilized by controllers and handle the presentation of data to the user Built in implementations are HTMLViewRenderer and JSONViewRenderer
Tags
Table of Contents
Methods
- getViewVariable() : mixed
- Get a single view variable by its name
- getViewVariables() : array<string|int, mixed>
- Get the registered view variables
- registerAppContextProperty() : void
- Push to the array of registered appContext variables
- registerViewVariable() : void
- Push to the array of registered view variables
- renderView() : void
- Display the content of the view
- setPage() : void
- Registers the current page with the ViewRenderer
- setView() : void
- setViewVariables() : void
- Set all variables associated with the view at once.
Methods
getViewVariable()
Get a single view variable by its name
public
getViewVariable(string $name) : mixed
Parameters
- $name : string
-
The name of the variable
Return values
mixed —$viewVariable
getViewVariables()
Get the registered view variables
public
getViewVariables() : array<string|int, mixed>
Return values
array<string|int, mixed> —$viewVariables
registerAppContextProperty()
Push to the array of registered appContext variables
public
registerAppContextProperty(string $name, mixed $data) : void
Parameters
- $name : string
-
- The name of the variable
- $data : mixed
-
- The value(s) of the view variable
registerViewVariable()
Push to the array of registered view variables
public
registerViewVariable(string $name, mixed $data) : void
Parameters
- $name : string
-
- The name of the variable
- $data : mixed
-
- The value(s) of the view variable
renderView()
Display the content of the view
public
renderView() : void
setPage()
Registers the current page with the ViewRenderer
public
setPage(SitePage $page) : void
Parameters
- $page : SitePage
-
The current SitePage
setView()
public
setView(string $viewName, bool $isAdmin) : void
Parameters
- $viewName : string
-
A string representing the name of the view
- $isAdmin : bool
-
Define the view as admin or standard
setViewVariables()
Set all variables associated with the view at once.
public
setViewVariables(array<string|int, mixed> $data) : void
This can also be expected to overwrite previously set view variables
Parameters
- $data : array<string|int, mixed>