AbstractView
abstract class AbstractView implements ViewInterface (View source)
An abstract View
Properties
protected array | $supportedOptions | This contains the supported options, their default values, descriptions and types. |
|
protected array | $options | The configuration options of this view |
|
protected array | $variables | View variables and their values |
|
protected ControllerContext | $controllerContext |
Methods
Factory method to create an instance with given options.
Set default options based on the supportedOptions provided
Get a specific option of this View
Set a specific option of this View
Add a variable to $this->variables.
Add multiple variables to $this->variables.
Tells if the view implementation can render the view for the given context.
Details
static ViewInterface
createWithOptions(array $options)
Factory method to create an instance with given options.
__construct(array $options = [])
Set default options based on the supportedOptions provided
mixed
getOption(string $optionName)
Get a specific option of this View
void
setOption(string $optionName, mixed $value)
Set a specific option of this View
ViewInterface
assign(string $key, mixed $value)
Add a variable to $this->variables.
Can be chained, so $this->view->assign(..., ...)->assign(..., ...); is possible
ViewInterface
assignMultiple(array $values)
Add multiple variables to $this->variables.
void
setControllerContext(ControllerContext $controllerContext)
Sets the current controller context
bool
canRender(ControllerContext $controllerContext)
Tells if the view implementation can render the view for the given context.
By default we assume that the view implementation can handle all kinds of contexts. Override this method if that is not the case.