InterceptorMiddleware
extends BaseViewMiddleware
in package
InterceptorMiddleware allows the client template to provide a callback for a route.
Interceptors are defined in the client config and can come in two versions, either built in or core:
'view' => [
'interceptors' => [
'/' => '\Ceo\Compat\Interceptors\IndexInterceptor',
'/article/*' => 'ArticleInterceptor', // to use custom interceptor
'/section/{slug}' => '\Ceo\Compat\Interceptors\SectionInterceptor',
]
]
Referencing a full namespace will load the core Interceptor, referencing a class name will cause the interceptor middleware to look in the client's "interceptors" folder for a similarly named class.
Additionally, you can use standard route placeholders to match specific routes or use the
*
to match ALL routes (including bare routes) under a path.
Table of Contents
- afterRender() : mixed
- getMatchedInterceptor() : string
- Determine matched interceptor based on route.
- handle() : mixed
- Handle uncached intercepter call.
- injectMessage() : string
- Inject message output HTML. Will keep all messages contained to the same container. Can be styled via #__ceo-debug-message ID.
- loadInterceptor() : object
- Load interceptor via class name
- register() : mixed
- transformAnyFilter() : string
- Stars will match any route within the scheme.
Methods
afterRender()
public
afterRender(Event $event, mixed $view) : mixed
Parameters
- $event : Event
- $view : mixed
Return values
mixed —getMatchedInterceptor()
Determine matched interceptor based on route.
public
getMatchedInterceptor() : string
Return values
string —matched interceptor class name
handle()
Handle uncached intercepter call.
public
handle(mixed $event, mixed $view) : mixed
Parameters
- $event : mixed
- $view : mixed
Return values
mixed —injectMessage()
Inject message output HTML. Will keep all messages contained to the same container. Can be styled via #__ceo-debug-message ID.
public
injectMessage(mixed $content, mixed $message[, mixed $newLine = true ]) : string
Parameters
- $content : mixed
- $message : mixed
- $newLine : mixed = true
Return values
string —output content
loadInterceptor()
Load interceptor via class name
public
loadInterceptor(mixed $matchedInterceptor) : object
Parameters
- $matchedInterceptor : mixed
Return values
object —Interceptor
register()
public
register() : mixed
Return values
mixed —transformAnyFilter()
Stars will match any route within the scheme.
private
transformAnyFilter(mixed $route) : string
Parameters
- $route : mixed