Merge pull request #10286 from freezernick/patch-1

DOCS: address broken code samples
This commit is contained in:
Daniel Hensby 2022-04-21 16:04:05 +01:00 committed by GitHub
commit ab0f6228c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,6 +26,7 @@ will deliberately return a different response, e.g. an error response or a redir
```php
use SilverStripe\Control\Middleware\HTTPMiddleware;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\HTTPResponse;
class CustomMiddleware implements HTTPMiddleware
{
@ -75,7 +76,7 @@ SilverStripe\Core\Injector\Injector:
SilverStripe\Control\Director:
properties:
Middlewares:
CustomMiddleware: %$CustomMiddleware
CustomMiddleware: '%$CustomMiddleware'
```
@ -89,7 +90,7 @@ SilverStripe\Core\Injector\Injector:
SilverStripe\Control\Director:
properties:
Middlewares:
CustomMiddleware: %$ConfiguredMiddleware
CustomMiddleware: '%$ConfiguredMiddleware'
ConfiguredMiddleware:
class: 'CustomMiddleware'
properties:
@ -111,14 +112,14 @@ SilverStripe\Core\Injector\Injector:
SpecialRouteMiddleware:
class: SilverStripe\Control\Middleware\RequestHandlerMiddlewareAdapter
properties:
RequestHandler: %$MyController
RequestHandler: '%$MyController'
Middlewares:
- %$CustomMiddleware
- %$AnotherMiddleware
- '%$CustomMiddleware'
- '%$AnotherMiddleware'
SilverStripe\Control\Director:
rules:
special\section:
Controller: %$SpecialRouteMiddleware
special/section:
Controller: '%$SpecialRouteMiddleware'
```
## Application middleware