Interface

eZ\Publish\Core\MVC\Symfony\View\View

interface View

Main interface for Views of Value objects (content, block...).

Methods

setTemplateIdentifier(string|Closure $templateIdentifier)

Sets $templateIdentifier to the content view.

string|Closure getTemplateIdentifier()

Returns the registered template identifier.

setParameters(array $parameters)

Sets $parameters that will later be injected to the template/closure.

addParameters(array $parameters)

Adds a hash of parameters to the existing parameters.

array getParameters()

Returns registered parameters.

bool hasParameter(string $parameterName)

Checks if $parameterName exists.

mixed getParameter(string $parameterName)

Returns parameter value by $parameterName.

setConfigHash(array $config)

Injects the config hash that was used to match and generate the current view.

array|null getConfigHash()

Returns the config hash.

setViewType($viewType)

getViewType()

setControllerReference(ControllerReference $controllerReference)

ControllerReference getControllerReference()

setResponse(Response $response)

Sets a pre-configured Response that will be used to render the View.

Response|null getResponse()

Returns the pre-configured Response.

Details

at line 38
public setTemplateIdentifier(string|Closure $templateIdentifier)

Sets $templateIdentifier to the content view.

Can be either a valid template identifier such as "MyBundle:subfolder:my_template.html.twig" or a closure. In the case of a closure, it will receive an array of parameters as an argument and must return the result to display.

The prototype of the closure must be : function (array $params = []) { // Do something to render // Must return a string to display } Must throw a \eZ\Publish\Core\Base\Exceptions\InvalidArgumentType exception if $templateIdentifier is invalid.

Parameters

string|Closure $templateIdentifier

Exceptions

InvalidArgumentType

at line 45
public string|Closure getTemplateIdentifier()

Returns the registered template identifier.

Return Value

string|Closure

at line 53
public setParameters(array $parameters)

Sets $parameters that will later be injected to the template/closure.

If some parameters were already present, $parameters will replace them.

Parameters

array $parameters Hash of parameters

at line 60
public addParameters(array $parameters)

Adds a hash of parameters to the existing parameters.

Parameters

array $parameters

at line 67
public array getParameters()

Returns registered parameters.

Return Value

array

at line 76
public bool hasParameter(string $parameterName)

Checks if $parameterName exists.

Parameters

string $parameterName

Return Value

bool

at line 88
public mixed getParameter(string $parameterName)

Returns parameter value by $parameterName.

Throws an \InvalidArgumentException if $parameterName is not set.

Parameters

string $parameterName

Return Value

mixed

Exceptions

InvalidArgumentException

at line 99
public setConfigHash(array $config)

Injects the config hash that was used to match and generate the current view.

Typically, the hash would have as keys: - template : The template that has been matched - match : The matching configuration, including the matcher "identifier" and what has been passed to it. - matcher : The matcher object.

Parameters

array $config

at line 106
public array|null getConfigHash()

Returns the config hash.

Return Value

array|null

at line 108
public setViewType($viewType)

Parameters

$viewType

at line 110
public getViewType()

at line 112
public setControllerReference(ControllerReference $controllerReference)

Parameters

ControllerReference $controllerReference

at line 117
public ControllerReference getControllerReference()

Return Value

ControllerReference

at line 124
public setResponse(Response $response)

Sets a pre-configured Response that will be used to render the View.

Parameters

Response $response

at line 131
public Response|null getResponse()

Returns the pre-configured Response.

Return Value

Response|null