class InterceptorMiddleware extends BaseViewMiddleware

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.

Methods

register()

No description

afterRender(Event $event, $view)

No description

string
injectMessage(string $content, string $message, boolean $newLine = true)

Inject message output HTML. Will keep all messages contained to the same container. Can be styled via #__ceo-debug-message ID.

handle($event, $view)

Handle uncached intercepter call.

string
getMatchedInterceptor()

Determine matched interceptor based on route.

object
loadInterceptor(string $matchedInterceptor)

Load interceptor via class name

Details

in BaseViewMiddleware at line 14
register()

in BaseViewMiddleware at line 25
afterRender(Event $event, $view)

Parameters

Event $event
$view

in BaseViewMiddleware at line 38
string injectMessage(string $content, string $message, boolean $newLine = true)

Inject message output HTML. Will keep all messages contained to the same container. Can be styled via #__ceo-debug-message ID.

Parameters

string $content output content
string $message your message, can contain HTML
boolean $newLine insert a new line when appending messages

Return Value

string output content

at line 36
handle($event, $view)

Handle uncached intercepter call.

Parameters

$event
$view

at line 78
string getMatchedInterceptor()

Determine matched interceptor based on route.

Return Value

string matched interceptor class name

at line 122
object loadInterceptor(string $matchedInterceptor)

Load interceptor via class name

Parameters

string $matchedInterceptor interceptor class name

Return Value

object Interceptor