MediaWiki  master
ResourceLoaderSiteModule.php
Go to the documentation of this file.
1 <?php
31  protected $targets = [ 'desktop', 'mobile' ];
32 
39  protected function getPages( ResourceLoaderContext $context ) {
40  $pages = [];
41  if ( $this->getConfig()->get( 'UseSiteJs' ) ) {
42  $skin = $context->getSkin();
43  $pages['MediaWiki:Common.js'] = [ 'type' => 'script' ];
44  $pages['MediaWiki:' . ucfirst( $skin ) . '.js'] = [ 'type' => 'script' ];
45  $this->getHookRunner()->onResourceLoaderSiteModulePages( $skin, $pages );
46  }
47  return $pages;
48  }
49 
54  public function getDependencies( ResourceLoaderContext $context = null ) {
55  return [ 'site.styles' ];
56  }
57 }
ResourceLoaderContext
Context object that contains information about the state of a specific ResourceLoader web request.
Definition: ResourceLoaderContext.php:33
ResourceLoaderModule\getHookRunner
getHookRunner()
Get a HookRunner for running core hooks.
Definition: ResourceLoaderModule.php:269
ResourceLoaderWikiModule
Abstraction for ResourceLoader modules which pull from wiki pages.
Definition: ResourceLoaderWikiModule.php:55
ResourceLoaderSiteModule
Module for site customizations.
Definition: ResourceLoaderSiteModule.php:29
ResourceLoaderSiteModule\getDependencies
getDependencies(ResourceLoaderContext $context=null)
Definition: ResourceLoaderSiteModule.php:54
ResourceLoaderContext\getSkin
getSkin()
Definition: ResourceLoaderContext.php:188
ResourceLoaderSiteModule\$targets
string[] $targets
What client platforms the module targets (e.g.
Definition: ResourceLoaderSiteModule.php:31
ResourceLoaderModule\getConfig
getConfig()
Definition: ResourceLoaderModule.php:218
ResourceLoaderSiteModule\getPages
getPages(ResourceLoaderContext $context)
Get list of pages used by this module.
Definition: ResourceLoaderSiteModule.php:39