MediaWiki  master
HookRunner.php
Go to the documentation of this file.
1 <?php
2 
4 
7 
12 class HookRunner implements
13  \MediaWiki\ResourceLoader\Hook\ResourceLoaderForeignApiModulesHook,
14  \MediaWiki\ResourceLoader\Hook\ResourceLoaderRegisterModulesHook,
15  \MediaWiki\ResourceLoader\Hook\ResourceLoaderSiteModulePagesHook,
16  \MediaWiki\ResourceLoader\Hook\ResourceLoaderSiteStylesModulePagesHook,
17  \MediaWiki\ResourceLoader\Hook\ResourceLoaderTestModulesHook
18 {
20  private $container;
21 
22  public function __construct( HookContainer $container ) {
23  $this->container = $container;
24  }
25 
26  public function onResourceLoaderForeignApiModules( &$dependencies, $context ) : void {
27  $this->container->run(
28  'ResourceLoaderForeignApiModules',
29  [ &$dependencies, $context ],
30  [ 'abortable' => false ]
31  );
32  }
33 
34  public function onResourceLoaderRegisterModules( ResourceLoader $rl ) : void {
35  $this->container->run(
36  'ResourceLoaderRegisterModules',
37  [ $rl ],
38  [ 'abortable' => false ]
39  );
40  }
41 
42  public function onResourceLoaderSiteModulePages( $skin, array &$pages ) : void {
43  $this->container->run(
44  'ResourceLoaderSiteModulePages',
45  [ $skin, &$pages ],
46  [ 'abortable' => false ]
47  );
48  }
49 
50  public function onResourceLoaderSiteStylesModulePages( $skin, array &$pages ) : void {
51  $this->container->run(
52  'ResourceLoaderSiteStylesModulePages',
53  [ $skin, &$pages ],
54  [ 'abortable' => false ]
55  );
56  }
57 
58  public function onResourceLoaderTestModules( array &$testModules, ResourceLoader $rl ) : void {
59  $this->container->run(
60  'ResourceLoaderTestModules',
61  [ &$testModules, $rl ],
62  [ 'abortable' => false ]
63  );
64  }
65 }
ResourceLoader\HookRunner\onResourceLoaderSiteModulePages
onResourceLoaderSiteModulePages( $skin, array &$pages)
Change which wiki pages comprise the site module in given skin.
Definition: HookRunner.php:42
ResourceLoader\HookRunner\onResourceLoaderSiteStylesModulePages
onResourceLoaderSiteStylesModulePages( $skin, array &$pages)
Change which wiki pages comprise the site.styles module in given skin.
Definition: HookRunner.php:50
ResourceLoader\HookRunner
Definition: HookRunner.php:18
ResourceLoader\HookRunner\__construct
__construct(HookContainer $container)
Definition: HookRunner.php:22
ResourceLoader\HookRunner\onResourceLoaderForeignApiModules
onResourceLoaderForeignApiModules(&$dependencies, $context)
Add dependencies to the mediawiki.ForeignApi module when you wish to override its behavior.
Definition: HookRunner.php:26
MediaWiki\ResourceLoader
ResourceLoader
ResourceLoader is a loading system for JavaScript and CSS resources.
Definition: ResourceLoader.php:56
ResourceLoader\HookRunner\onResourceLoaderTestModules
onResourceLoaderTestModules(array &$testModules, ResourceLoader $rl)
Use this hook to register ResourceLoader modules that are only available when $wgEnableJavaScriptTest...
Definition: HookRunner.php:58
MediaWiki\HookContainer\HookContainer
HookContainer class.
Definition: HookContainer.php:45
MediaWiki\$context
IContextSource $context
Definition: MediaWiki.php:40
ResourceLoader\HookRunner\$container
HookContainer $container
Definition: HookRunner.php:20
ResourceLoader\HookRunner\onResourceLoaderRegisterModules
onResourceLoaderRegisterModules(ResourceLoader $rl)
This hook is called right before modules information is required, such as when responding to a resour...
Definition: HookRunner.php:34