Class AcceptableViewModelSelector

Summary

Fully Qualified Name: Zend\Mvc\Controller\Plugin\AcceptableViewModelSelector
Extends: AbstractPlugin

Description

Controller Plugin to assist in selecting an appropriate View Model type based on the User Agent's accept header.

Methods

Name Description Defined By
__invoke() Detects an appropriate viewmodel for request. AcceptableViewModelSelector
getController() Get the current controller instance AbstractPlugin
getDefaultMatchAgainst() Get the default Accept Types and View Model combinations to match against if none are specified. AcceptableViewModelSelector
getDefaultViewModelName() Set the default View Model (name) to return if no match could be made AcceptableViewModelSelector
getViewModel() Detects an appropriate viewmodel for request. AcceptableViewModelSelector
getViewModelName() Detects an appropriate viewmodel name for request. AcceptableViewModelSelector
match() Detects an appropriate viewmodel name for request. AcceptableViewModelSelector
setController() Set the current controller instance AbstractPlugin
setDefaultMatchAgainst() Set the default Accept Types and View Model combinations to match against if none are specified. AcceptableViewModelSelector
setDefaultViewModelName() Set the default View Model (name) to return if no match could be made AcceptableViewModelSelector

Method Details

__invoke()

Detects an appropriate viewmodel for request.

Parameter Name Type Description
$matchAgainst array (optional)
$returnDefault bool (optional)
$resultReference \AbstractFieldValuePart|null (optional)

Returns: \ModelInterface|null

getController()

Get the current controller instance

Returns: null|\Dispatchable

getDefaultMatchAgainst()

Get the default Accept Types and View Model combinations to match against if none are specified.

Returns: array|null

getDefaultViewModelName()

Set the default View Model (name) to return if no match could be made

Returns: string

getViewModel()

Detects an appropriate viewmodel for request.

Parameter Name Type Description
$matchAgainst array (optional)
$returnDefault bool (optional)
$resultReference \AbstractFieldValuePart|null (optional)

Returns: \ModelInterface|null

getViewModelName()

Detects an appropriate viewmodel name for request.

Parameter Name Type Description
$matchAgainst array (optional)
$returnDefault bool (optional)
$resultReference \AbstractFieldValuePart|null (optional)

Returns: \ModelInterface|null Returns null if $returnDefault = false and no match could be made

match()

Detects an appropriate viewmodel name for request.

Parameter Name Type Description
$matchAgainst array (optional)

Returns: \AbstractFieldValuePart|null The object that was matched

setController()

Set the current controller instance

Parameter Name Type Description
$controller \Dispatchable

Returns: void

setDefaultMatchAgainst()

Set the default Accept Types and View Model combinations to match against if none are specified.

Parameter Name Type Description
$matchAgainst array (optional)

Returns: \AcceptableViewModelSelector provides fluent interface

setDefaultViewModelName()

Set the default View Model (name) to return if no match could be made

Parameter Name Type Description
$defaultViewModelName string The

Returns: \AcceptableViewModelSelector provides fluent interface

Top