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

Commit 5baf0e1

Browse files
committed
Adds documentation for #629
Documents the new `$layout` argument, configuration options, and defaults for the `ErrorResponseGenerator`. Additionally, provides the default values for template and layout-related constants defined by both the `NotFoundHandler` and `ErrorResponseGenerator`.
1 parent 955004b commit 5baf0e1

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

docs/book/v3/features/container/factories.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ When the `config` service is present, the factory can utilize two values:
8181
- `zend-expressive.error_handler.template_error`, a name of an alternate
8282
template to use (instead of the default represented in the
8383
`Zend\Expressive\Middleware\ErrorResponseGenerator::TEMPLATE_DEFAULT`
84-
constant).
84+
constant, which evaluates to `error::error`).
85+
- **Since 3.1.0**: `zend-expressive.error_handler.layout`, a name of an
86+
alternate layout to use (instead of the default represented in the
87+
`Zend\Expressive\Middleware\ErrorResponseGenerator::LAYOUT_DEFAULT` constant,
88+
which evaluates to `layout::default`).
8589

8690
As an example:
8791

@@ -90,6 +94,7 @@ As an example:
9094
'zend-expressive' => [
9195
'error_handler' => [
9296
'template_error' => 'name of error template',
97+
'layout' => 'layout::alternate',
9398
],
9499
],
95100
```
@@ -150,14 +155,21 @@ When the `config` service is present, the factory can utilize two values:
150155

151156
- `zend-expressive.error_handler.template_404`, a name of an alternate
152157
template to use (instead of the default represented in the
153-
`Zend\Expressive\Delegate\NotFoundDelegate::TEMPLATE_DEFAULT` constant).
158+
`Zend\Expressive\Delegate\NotFoundDelegate::TEMPLATE_DEFAULT` constant, which
159+
evaluates to `error::404`).
160+
161+
- `zend-expressive.error_handler.layout`, a name of an alternate
162+
template to use (instead of the default represented in the
163+
`Zend\Expressive\Delegate\NotFoundDelegate::TEMPLATE_DEFAULT` constant, which
164+
evaluates to `layout::default`).
154165

155166
As an example:
156167

157168
```php
158169
'zend-expressive' => [
159170
'error_handler' => [
160171
'template_404' => 'name of 404 template',
172+
'layout' => 'layout::alternate',
161173
],
162174
],
163175
```

docs/book/v3/features/error-handling.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ We provide two error response generators for you:
7171
otherwise, a plain text response is generated that notes the request method
7272
and URI.
7373

74+
Since version 3.1.0, it also accepts a layout name, if you want to use one
75+
other than `layout::default`.
76+
7477
- `Zend\Expressive\Middleware\WhoopsErrorResponseGenerator`, which uses
7578
[whoops](http://filp.github.io/whoops/) to present detailed exception
7679
and request information; this implementation is intended for development

0 commit comments

Comments
 (0)