Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit ce311dc

Browse files
Add specifics about the first view model as a fallback
1 parent 2df5396 commit ce311dc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

doc/book/plugins.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ use Zend\Mvc\Controller\AbstractActionController;
4444
class SomeController extends AbstractActionController
4545
{
4646
protected $acceptCriteria = [
47-
// Make sure ViewModel is the first as a fallback
4847
\Zend\View\Model\ViewModel::class => [
4948
'text/html',
5049
'application/xhtml+xml',
@@ -73,10 +72,12 @@ class SomeController extends AbstractActionController
7372

7473
The above would return a standard `Zend\View\Model\ViewModel` instance if no
7574
criterias are met, and the specified view model types if a specific criteria
76-
is met. Rules are matched in order, with the first match "winning."
75+
is met. Rules are matched in order, with the first match "winning".
76+
Make sure to put your fallback view model *first* as a fallback for unknown
77+
content types or `*/*`.
7778

78-
> Browsers are sending `*/*` as last part of the Accept header so you have to define every
79-
> acceptable view model and their Accept-Header part. Otherwise the first view model will be used.
79+
> Browsers are sending `*/*` as last content type of the Accept header so you have to define every
80+
> acceptable view model and their content type.
8081
8182
## Forward Plugin
8283

0 commit comments

Comments
 (0)