Debian Codegraph @

includes/Output/Hook/MakeGlobalVariablesScriptHook.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Output\Hook;
4
5 use MediaWiki\Output\OutputPage;
6
7 /**
8 * This is a hook handler interface, see docs/Hooks.md.
9 * Use the hook name "MakeGlobalVariablesScript" to register handlers implementing this interface.
10 *
11 * @stable to implement
12 * @ingroup Hooks
13 */
14 interface MakeGlobalVariablesScriptHook {
15 /**
16 * Export user- or page-specific `mw.config` variables to JavaScript.
17 *
18 * When using this hook, be as selective as possible about when the data is set.
19 * Reduce the cost by setting values only for specific titles, namespaces, or user-rights.
20 *
21 * Data exported here is transmitted with the highest possible bandwidth priority (ahead of
22 * page content even). Any data that is not dependant on the current request, should go
23 * through MediaWiki\ResourceLoader\Hook\ResourceLoaderGetConfigVarsHook instead.
24 *
25 * This hook is called from OutputPage::getJSVars.
26 *
27 * @since 1.35
28 *
29 * @param array &$vars Variable (or multiple variables)
30 * @param OutputPage $out OutputPage which called the hook, can be used to get the real title
31 * @return void This hook must not abort, it must return no value
32 */
33 public function onMakeGlobalVariablesScript( &$vars, $out ): void;
34 }
35
36 /** @deprecated class alias since 1.42 */
37 class_alias( MakeGlobalVariablesScriptHook::class, 'MediaWiki\Hook\MakeGlobalVariablesScriptHook' );