2017-06-06 23:38:57 +00:00
|
|
|
<?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 {
|
2017-07-13 15:22:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets list of names of modules this module depends on.
|
|
|
|
*
|
|
|
|
* @param ResourceLoaderContext|null $context Resource loader context
|
|
|
|
* @return array List of module names
|
|
|
|
*/
|
2017-06-06 23:38:57 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|