2020-03-03 22:50:34 +00:00
|
|
|
<?php
|
|
|
|
|
|
2024-02-06 17:22:55 +00:00
|
|
|
namespace MediaWiki\Output\Hook;
|
2020-03-03 22:50:34 +00:00
|
|
|
|
2023-09-05 17:31:53 +00:00
|
|
|
use MediaWiki\Output\OutputPage;
|
2020-03-16 23:31:05 +00:00
|
|
|
|
2020-03-03 22:50:34 +00:00
|
|
|
/**
|
2020-09-26 13:18:43 +00:00
|
|
|
* This is a hook handler interface, see docs/Hooks.md.
|
|
|
|
|
* Use the hook name "MakeGlobalVariablesScript" to register handlers implementing this interface.
|
|
|
|
|
*
|
2020-07-13 09:05:49 +00:00
|
|
|
* @stable to implement
|
2020-03-03 22:50:34 +00:00
|
|
|
* @ingroup Hooks
|
|
|
|
|
*/
|
|
|
|
|
interface MakeGlobalVariablesScriptHook {
|
|
|
|
|
/**
|
2021-03-10 23:57:43 +00:00
|
|
|
* Export user- or page-specific `mw.config` variables to JavaScript.
|
|
|
|
|
*
|
|
|
|
|
* When using this hook, be as selective as possible about when the data is set.
|
|
|
|
|
* Reduce the cost by setting values only for specific titles, namespaces, or user-rights.
|
|
|
|
|
*
|
|
|
|
|
* Data exported here is transmitted with the highest possible bandwidth priority (ahead of
|
|
|
|
|
* page content even). Any data that is not dependant on the current request, should go
|
|
|
|
|
* through MediaWiki\ResourceLoader\Hook\ResourceLoaderGetConfigVarsHook instead.
|
|
|
|
|
*
|
|
|
|
|
* This hook is called from OutputPage::getJSVars.
|
2020-03-03 22:50:34 +00:00
|
|
|
*
|
|
|
|
|
* @since 1.35
|
|
|
|
|
*
|
2020-08-18 11:51:48 +00:00
|
|
|
* @param array &$vars Variable (or multiple variables)
|
2020-03-16 23:31:05 +00:00
|
|
|
* @param OutputPage $out OutputPage which called the hook, can be used to get the real title
|
2021-03-10 23:57:43 +00:00
|
|
|
* @return void This hook must not abort, it must return no value
|
2020-03-03 22:50:34 +00:00
|
|
|
*/
|
2021-07-22 03:11:47 +00:00
|
|
|
public function onMakeGlobalVariablesScript( &$vars, $out ): void;
|
2020-03-03 22:50:34 +00:00
|
|
|
}
|
2024-02-06 17:22:55 +00:00
|
|
|
|
2024-07-05 16:16:27 +00:00
|
|
|
/** @deprecated class alias since 1.42 */
|
2024-02-06 17:22:55 +00:00
|
|
|
class_alias( MakeGlobalVariablesScriptHook::class, 'MediaWiki\Hook\MakeGlobalVariablesScriptHook' );
|