]> BookStack Code Mirror - bookstack/blob - app/Theming/ThemeEvents.php
a81179ed7cd86e5341aecbec1d72b3926b2b1b63
[bookstack] / app / Theming / ThemeEvents.php
1 <?php namespace BookStack\Theming;
2
3 /**
4  * The ThemeEvents used within BookStack.
5  *
6  * This file details the events that BookStack may fire via the custom
7  * theme system, including event names, parameters and expected return types.
8  *
9  * This system is regarded as semi-stable.
10  * We'll look to fix issues with it or migrate old event types but
11  * events and their signatures may change in new versions of BookStack.
12  * We'd advise testing any usage of these events upon upgrade.
13  */
14 class ThemeEvents
15 {
16     /**
17      * Application boot-up.
18      * After main services are registered.
19      * @param \BookStack\Application $app
20      */
21     const APP_BOOT = 'app_boot';
22
23     /**
24      * Web before middleware action.
25      * Runs before the request is handled but after all other middleware apart from those
26      * that depend on the current session user (Localization for example).
27      * Provides the original request to use.
28      * Return values, if provided, will be used as a new response to use.
29      * @param \Illuminate\Http\Request $request
30      * @returns \Illuminate\Http\Response|null
31      */
32     const WEB_MIDDLEWARE_BEFORE = 'web_middleware_before';
33
34     /**
35      * Web after middleware action.
36      * Runs after the request is handled but before the response is sent.
37      * Provides both the original request and the currently resolved response.
38      * Return values, if provided, will be used as a new response to use.
39      * @param \Illuminate\Http\Request $request
40      * @returns \Illuminate\Http\Response|null
41      */
42     const WEB_MIDDLEWARE_AFTER = 'web_middleware_after';
43
44     /**
45      * Commonmark environment configure.
46      * Provides the commonmark library environment for customization
47      * before its used to render markdown content.
48      * If the listener returns a non-null value, that will be used as an environment instead.
49      * @param \League\CommonMark\ConfigurableEnvironmentInterface $environment
50      * @returns \League\CommonMark\ConfigurableEnvironmentInterface|null
51      */
52     const COMMONMARK_ENVIRONMENT_CONFIGURE = 'commonmark_environment_configure';
53 }