PHP Class Neos\Flow\Mvc\View\AbstractView

Inheritance: implements Neos\Flow\Mvc\View\ViewInterface
Show file Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$controllerContext Neos\Flow\Mvc\Controller\ControllerContext
$options array The configuration options of this view
$supportedOptions array Syntax example: array( 'someOptionName' => array('defaultValue', 'some description', 'string'), 'someOtherOptionName' => array('defaultValue', some description', integer), ... )
$variables array View variables and their values

Public Methods

Method Description
__construct ( array $options = [] ) Set default options based on the supportedOptions provided
assign ( string $key, mixed $value ) : AbstractView Add a variable to $this->variables.
assignMultiple ( array $values ) : AbstractView Add multiple variables to $this->variables.
canRender ( ControllerContext $controllerContext ) : boolean Tells if the view implementation can render the view for the given context.
createWithOptions ( array $options ) : Neos\Flow\Mvc\View\ViewInterface Factory method to create an instance with given options.
getOption ( string $optionName ) : mixed Get a specific option of this View
setControllerContext ( ControllerContext $controllerContext ) : void Sets the current controller context
setOption ( string $optionName, mixed $value ) : void Set a specific option of this View

Method Details

__construct() public method

Set default options based on the supportedOptions provided
public __construct ( array $options = [] )
$options array

assign() public method

Can be chained, so $this->view->assign(..., ...)->assign(..., ...); is possible
public assign ( string $key, mixed $value ) : AbstractView
$key string Key of variable
$value mixed Value of object
return AbstractView an instance of $this, to enable chaining

assignMultiple() public method

Add multiple variables to $this->variables.
public assignMultiple ( array $values ) : AbstractView
$values array array in the format array(key1 => value1, key2 => value2)
return AbstractView an instance of $this, to enable chaining

canRender() public method

By default we assume that the view implementation can handle all kinds of contexts. Override this method if that is not the case.
public canRender ( ControllerContext $controllerContext ) : boolean
$controllerContext Neos\Flow\Mvc\Controller\ControllerContext
return boolean TRUE if the view has something useful to display, otherwise FALSE

createWithOptions() public static method

Factory method to create an instance with given options.
public static createWithOptions ( array $options ) : Neos\Flow\Mvc\View\ViewInterface
$options array
return Neos\Flow\Mvc\View\ViewInterface

getOption() public method

Get a specific option of this View
public getOption ( string $optionName ) : mixed
$optionName string
return mixed

setControllerContext() public method

Sets the current controller context
public setControllerContext ( ControllerContext $controllerContext ) : void
$controllerContext Neos\Flow\Mvc\Controller\ControllerContext
return void

setOption() public method

Set a specific option of this View
public setOption ( string $optionName, mixed $value ) : void
$optionName string
$value mixed
return void

Property Details

$controllerContext protected property

protected ControllerContext,Neos\Flow\Mvc\Controller $controllerContext
return Neos\Flow\Mvc\Controller\ControllerContext

$options protected property

The configuration options of this view
protected array $options
return array

$supportedOptions protected property

Syntax example: array( 'someOptionName' => array('defaultValue', 'some description', 'string'), 'someOtherOptionName' => array('defaultValue', some description', integer), ... )
protected array $supportedOptions
return array

$variables protected property

View variables and their values
See also: assign()
protected array $variables
return array