MediaWiki  master
SiteModule.php
Go to the documentation of this file.
1 <?php
23 namespace MediaWiki\ResourceLoader;
24 
26 
33 class SiteModule extends WikiModule {
35  protected $targets = [ 'desktop', 'mobile' ];
36 
43  protected function getPages( Context $context ) {
44  $pages = [];
45  if ( $this->getConfig()->get( MainConfigNames::UseSiteJs ) ) {
46  $skin = $context->getSkin();
47  $pages['MediaWiki:Common.js'] = [ 'type' => 'script' ];
48  $pages['MediaWiki:' . ucfirst( $skin ) . '.js'] = [ 'type' => 'script' ];
49  $this->getHookRunner()->onResourceLoaderSiteModulePages( $skin, $pages );
50  }
51  return $pages;
52  }
53 
58  public function getDependencies( Context $context = null ) {
59  return [ 'site.styles' ];
60  }
61 }
62 
64 class_alias( SiteModule::class, 'ResourceLoaderSiteModule' );
A class containing constants representing the names of configuration variables.
const UseSiteJs
Name constant for the UseSiteJs setting, for use with Config::get()
Context object that contains information about the state of a specific ResourceLoader web request.
Definition: Context.php:46
getHookRunner()
Get a HookRunner for running core hooks.
Definition: Module.php:304
Module for site customizations.
Definition: SiteModule.php:33
getPages(Context $context)
Get list of pages used by this module.
Definition: SiteModule.php:43
getDependencies(Context $context=null)
Definition: SiteModule.php:58
string[] $targets
What client platforms the module targets (e.g.
Definition: SiteModule.php:35
Abstraction for ResourceLoader modules which pull from wiki pages.
Definition: WikiModule.php:65