3 namespace BookStack\Theming;
6 * The ThemeEvents used within BookStack.
8 * This file details the events that BookStack may fire via the custom
9 * theme system, including event names, parameters and expected return types.
11 * This system is regarded as semi-stable.
12 * We'll look to fix issues with it or migrate old event types but
13 * events and their signatures may change in new versions of BookStack.
14 * We'd advise testing any usage of these events upon upgrade.
19 * Application boot-up.
20 * After main services are registered.
22 * @param \BookStack\Application $app
24 const APP_BOOT = 'app_boot';
28 * Runs right after a user is logged-in to the application by any authentication
29 * system as a standard app user. This includes a user becoming logged in
30 * after registration. This is not emitted upon API usage.
32 * @param string $authSystem
33 * @param \BookStack\Auth\User $user
35 const AUTH_LOGIN = 'auth_login';
38 * Auth register event.
39 * Runs right after a user is newly registered to the application by any authentication
40 * system as a standard app user. This includes auto-registration systems used
41 * by LDAP, SAML and social systems. It only includes self-registrations.
43 * @param string $authSystem
44 * @param \BookStack\Auth\User $user
46 const AUTH_REGISTER = 'auth_register';
49 * Commonmark environment configure.
50 * Provides the commonmark library environment for customization
51 * before it's used to render markdown content.
52 * If the listener returns a non-null value, that will be used as an environment instead.
54 * @param \League\CommonMark\ConfigurableEnvironmentInterface $environment
55 * @returns \League\CommonMark\ConfigurableEnvironmentInterface|null
57 const COMMONMARK_ENVIRONMENT_CONFIGURE = 'commonmark_environment_configure';
60 * Web before middleware action.
61 * Runs before the request is handled but after all other middleware apart from those
62 * that depend on the current session user (Localization for example).
63 * Provides the original request to use.
64 * Return values, if provided, will be used as a new response to use.
66 * @param \Illuminate\Http\Request $request
67 * @returns \Illuminate\Http\Response|null
69 const WEB_MIDDLEWARE_BEFORE = 'web_middleware_before';
72 * Web after middleware action.
73 * Runs after the request is handled but before the response is sent.
74 * Provides both the original request and the currently resolved response.
75 * Return values, if provided, will be used as a new response to use.
77 * @param \Illuminate\Http\Request $request
78 * @param \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\BinaryFileResponse $response
79 * @returns \Illuminate\Http\Response|null
81 const WEB_MIDDLEWARE_AFTER = 'web_middleware_after';
84 * Webhook call before event.
85 * Runs before a webhook endpoint is called. Allows for customization
86 * of the data format & content within the webhook POST request.
87 * Provides the original event name as a string (see \BookStack\Actions\ActivityType)
88 * along with the webhook instance along with the event detail which may be a
89 * "Loggable" model type or a string.
90 * If the listener returns a non-null value, that will be used as the POST data instead
91 * of the system default.
93 * @param string $event
94 * @param \BookStack\Actions\Webhook $webhook
95 * @param string|\BookStack\Interfaces\Loggable $detail
96 * @param \BookStack\Auth\User $initiator
97 * @param int $initiatedTime
99 const WEBHOOK_CALL_BEFORE = 'webhook_call_before';