mediawiki-extensions-Relate.../includes/ResourceLoaderMuhoganModule.php
Piotr Miazga 88c7a705e2 Restore default MediaWiki codesniffer configuration
Changes:
 - re-enabled all sniffs
 - fixed code to meet MW code standards

Bug: T170589
Depends-On: Ib7f0bd15dd0a9255e1e5140907e800478b658b92
Change-Id: Idb08a3e105226877804a84b120c70e5defa7398c
2017-07-25 02:46:46 +00:00

34 lines
940 B
PHP

<?php
namespace RelatedArticles;
use ResourceLoaderFileModule;
use ResourceLoaderContext;
/**
* A ResourceLoader module that serves Hogan or Mustache depending on the
* current target.
*
* FIXME: this is a copy&paste from the QuickSurveys extension. Find a way to
* share the code or use mustache in MobileFrontend too.
*/
class ResourceLoaderMuHoganModule extends ResourceLoaderFileModule {
/**
* Gets list of names of modules this module depends on.
*
* @param ResourceLoaderContext|null $context Resource loader context
* @return array List of module names
*/
public function getDependencies( ResourceLoaderContext $context = null ) {
$dependencies = parent::getDependencies( $context );
if ( $context && $context->getRequest()->getVal( 'target' ) === 'mobile' ) {
$dependencies[] = 'mediawiki.template.hogan';
} else {
$dependencies[] = 'mediawiki.template.mustache';
}
return $dependencies;
}
}