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 * Activity logged event.
20 * Runs right after an activity is logged by bookstack.
21 * These are the activities that can be seen in the audit log area of BookStack.
22 * Activity types can be seen listed in the \BookStack\Actions\ActivityType class.
23 * The provided $detail can be a string or a loggable type of model. You should check
24 * the type before making use of this parameter.
27 * @param string|\BookStack\Interfaces\Loggable $detail
29 const ACTIVITY_LOGGED = 'activity_logged';
32 * Application boot-up.
33 * After main services are registered.
35 * @param \BookStack\Application $app
37 const APP_BOOT = 'app_boot';
41 * Runs right after a user is logged-in to the application by any authentication
42 * system as a standard app user. This includes a user becoming logged in
43 * after registration. This is not emitted upon API usage.
45 * @param string $authSystem
46 * @param \BookStack\Auth\User $user
48 const AUTH_LOGIN = 'auth_login';
51 * Auth register event.
52 * Runs right after a user is newly registered to the application by any authentication
53 * system as a standard app user. This includes auto-registration systems used
54 * by LDAP, SAML and social systems. It only includes self-registrations.
56 * @param string $authSystem
57 * @param \BookStack\Auth\User $user
59 const AUTH_REGISTER = 'auth_register';
62 * Commonmark environment configure.
63 * Provides the commonmark library environment for customization
64 * before it's used to render markdown content.
65 * If the listener returns a non-null value, that will be used as an environment instead.
67 * @param \League\CommonMark\ConfigurableEnvironmentInterface $environment
68 * @returns \League\CommonMark\ConfigurableEnvironmentInterface|null
70 const COMMONMARK_ENVIRONMENT_CONFIGURE = 'commonmark_environment_configure';
73 * Web before middleware action.
74 * Runs before the request is handled but after all other middleware apart from those
75 * that depend on the current session user (Localization for example).
76 * Provides the original request to use.
77 * Return values, if provided, will be used as a new response to use.
79 * @param \Illuminate\Http\Request $request
80 * @returns \Illuminate\Http\Response|null
82 const WEB_MIDDLEWARE_BEFORE = 'web_middleware_before';
85 * Web after middleware action.
86 * Runs after the request is handled but before the response is sent.
87 * Provides both the original request and the currently resolved response.
88 * Return values, if provided, will be used as a new response to use.
90 * @param \Illuminate\Http\Request $request
91 * @param \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\BinaryFileResponse $response
92 * @returns \Illuminate\Http\Response|null
94 const WEB_MIDDLEWARE_AFTER = 'web_middleware_after';
97 * Webhook call before event.
98 * Runs before a webhook endpoint is called. Allows for customization
99 * of the data format & content within the webhook POST request.
100 * Provides the original event name as a string (see \BookStack\Actions\ActivityType)
101 * along with the webhook instance along with the event detail which may be a
102 * "Loggable" model type or a string.
103 * If the listener returns a non-null value, that will be used as the POST data instead
104 * of the system default.
106 * @param string $event
107 * @param \BookStack\Actions\Webhook $webhook
108 * @param string|\BookStack\Interfaces\Loggable $detail
109 * @param \BookStack\Auth\User $initiator
110 * @param int $initiatedTime
112 const WEBHOOK_CALL_BEFORE = 'webhook_call_before';