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\Activity\Models\Loggable $detail
29 const ACTIVITY_LOGGED = 'activity_logged';
32 * Application boot-up.
33 * After main services are registered.
35 * @param \BookStack\App\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\Users\Models\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\Users\Models\User $user
59 const AUTH_REGISTER = 'auth_register';
62 * Commonmark environment configure.
63 * Provides the commonmark library environment for customization before it's used to render markdown content.
64 * If the listener returns a non-null value, that will be used as an environment instead.
66 * @param \League\CommonMark\Environment\Environment $environment
67 * @returns \League\CommonMark\Environment\Environment|null
69 const COMMONMARK_ENVIRONMENT_CONFIGURE = 'commonmark_environment_configure';
72 * OIDC ID token pre-validate event.
73 * Runs just before BookStack validates the user ID token data upon login.
74 * Provides the existing found set of claims for the user as a key-value array,
75 * along with an array of the proceeding access token data provided by the identity platform.
76 * If the listener returns a non-null value, that will replace the existing ID token claim data.
78 * @param array $idTokenData
79 * @param array $accessTokenData
82 const OIDC_ID_TOKEN_PRE_VALIDATE = 'oidc_id_token_pre_validate';
85 * Page include parse event.
86 * Runs when a page include tag is being parsed, typically when page content is being processed for viewing.
87 * Provides the "include tag" reference string, the default BookStack replacement content for the tag,
88 * the current page being processed, and the page that's being referenced by the include tag.
89 * The referenced page may be null where the page does not exist or where permissions prevent visibility.
90 * If the listener returns a non-null value, that will be used as the replacement HTML content instead.
92 * @param string $tagReference
93 * @param string $replacementHTML
94 * @param \BookStack\Entities\Models\Page $currentPage
95 * @param ?\BookStack\Entities\Models\Page $referencedPage
97 const PAGE_INCLUDE_PARSE = 'page_include_parse';
100 * Routes register web event.
101 * Called when standard web (browser/non-api) app routes are registered.
102 * Provides an app router, so you can register your own web routes.
104 * @param \Illuminate\Routing\Router
106 const ROUTES_REGISTER_WEB = 'routes_register_web';
109 * Routes register web auth event.
110 * Called when auth-required web (browser/non-api) app routes can be registered.
111 * These are routes that typically require login to access (unless the instance is made public).
112 * Provides an app router, so you can register your own web routes.
114 * @param \Illuminate\Routing\Router
116 const ROUTES_REGISTER_WEB_AUTH = 'routes_register_web_auth';
119 * Web before middleware action.
120 * Runs before the request is handled but after all other middleware apart from those
121 * that depend on the current session user (Localization for example).
122 * Provides the original request to use.
123 * Return values, if provided, will be used as a new response to use.
125 * @param \Illuminate\Http\Request $request
126 * @returns \Illuminate\Http\Response|null
128 const WEB_MIDDLEWARE_BEFORE = 'web_middleware_before';
131 * Web after middleware action.
132 * Runs after the request is handled but before the response is sent.
133 * Provides both the original request and the currently resolved response.
134 * Return values, if provided, will be used as a new response to use.
136 * @param \Illuminate\Http\Request $request
137 * @param \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\BinaryFileResponse $response
138 * @returns \Illuminate\Http\Response|null
140 const WEB_MIDDLEWARE_AFTER = 'web_middleware_after';
143 * Webhook call before event.
144 * Runs before a webhook endpoint is called. Allows for customization
145 * of the data format & content within the webhook POST request.
146 * Provides the original event name as a string (see \BookStack\Actions\ActivityType)
147 * along with the webhook instance along with the event detail which may be a
148 * "Loggable" model type or a string.
149 * If the listener returns a non-null value, that will be used as the POST data instead
150 * of the system default.
152 * @param string $event
153 * @param \BookStack\Activity\Models\Webhook $webhook
154 * @param string|\BookStack\Activity\Models\Loggable $detail
155 * @param \BookStack\Users\Models\User $initiator
156 * @param int $initiatedTime
157 * @returns array|null
159 const WEBHOOK_CALL_BEFORE = 'webhook_call_before';