Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | |
3 | namespace MediaWiki\ResourceLoader\Hook; |
4 | |
5 | use MediaWiki\ResourceLoader\Context; |
6 | |
7 | /** |
8 | * This is a hook handler interface, see docs/Hooks.md. |
9 | * Use the hook name "ResourceLoaderExcludeUserOptions" to register handlers implementing this interface. |
10 | * |
11 | * @stable to implement |
12 | * @ingroup ResourceLoaderHooks |
13 | */ |
14 | interface ResourceLoaderExcludeUserOptionsHook { |
15 | |
16 | /** |
17 | * Exclude a user option from the preloaded data for client-side mw.user.options. |
18 | * |
19 | * This hook is called on every index.php pageview (via ResourceLoaderUserOptionsModule), |
20 | * and when building responses for the "mediawiki.base" module. Avoid database queries |
21 | * or other expensive operations as that would increase page load time. |
22 | * |
23 | * Use this hook to optimize pageview HTML size by omitting user preference |
24 | * values from the export JavaScript data for `mw.user.options`. For example, |
25 | * when an extension stores large values in a user preference, and rarely or never |
26 | * needs these client-side, you can exclude it via this hook. (T251994) |
27 | * |
28 | * This will exclude both the default value (via mediawiki.base module) and |
29 | * the current user's value (via pageview HTML). |
30 | * |
31 | * @since 1.38 |
32 | * @param array &$keysToExclude |
33 | * @param Context $context |
34 | * @return void |
35 | */ |
36 | public function onResourceLoaderExcludeUserOptions( array &$keysToExclude, Context $context ): void; |
37 | } |