AbstractView implements ViewInterface
An abstract View
since TYPO3 v11, will be removed in TYPO3 v12.0. It is highly recommended to implement all needed logic of ViewInterface yourself
Table of Contents
Interfaces
- ViewInterface
- Interface of a view
Properties
- $controllerContext : ControllerContext
- $variables : array<string|int, mixed>
- View variables and their values
Methods
- assign() : AbstractView
- Add a variable to $this->viewData.
- assignMultiple() : AbstractView
- Add multiple variables to $this->viewData.
- canRender() : bool
- Tells if the view implementation can render the view for the given context.
- initializeView() : mixed
- Initializes this view.
- setControllerContext() : mixed
- Sets the current controller context
Properties
$controllerContext
protected
ControllerContext
$controllerContext
$variables
View variables and their values
protected
array<string|int, mixed>
$variables
= []
Tags
Methods
assign()
Add a variable to $this->viewData.
public
assign(string $key, mixed $value) : AbstractView
Can be chained, so $this->view->assign(..., ...)->assign(..., ...); is possible
Parameters
- $key : string
-
Key of variable
- $value : mixed
-
Value of object
Return values
AbstractView —an instance of $this, to enable chaining
assignMultiple()
Add multiple variables to $this->viewData.
public
assignMultiple(array<string|int, mixed> $values) : AbstractView
Parameters
- $values : array<string|int, mixed>
-
array in the format array(key1 => value1, key2 => value2).
Return values
AbstractView —an instance of $this, to enable chaining
canRender()
Tells if the view implementation can render the view for the given context.
public
canRender() : bool
since TYPO3 v11, will be removed in v12. Legacy method, not part of ViewInterface anymore.
By default we assume that the view implementation can handle all kinds of contexts. Override this method if that is not the case.
Return values
bool —TRUE if the view has something useful to display, otherwise FALSE
initializeView()
Initializes this view.
public
initializeView() : mixed
Override this method for initializing your concrete view implementation.
setControllerContext()
Sets the current controller context
public
setControllerContext(ControllerContext $controllerContext) : mixed
Parameters
- $controllerContext : ControllerContext