Compare commits

...

2 Commits

Author SHA1 Message Date
Daniel Hensby
ab0f6228c8
Merge pull request #10286 from freezernick/patch-1
DOCS: address broken code samples
2022-04-21 16:04:05 +01:00
FreezerNick
107c7196ac
DOC: Address broken code samples
Fixes syntax errors in YAML config samples and adds a missing PHP use statement for the HTTP Middlewares page
2022-04-21 13:31:15 +02:00

View File

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