| 1 |
<?php |
| 2 |
|
| 3 |
namespace Cite\ResourceLoader; |
| 4 |
|
| 5 |
use MediaWiki\MediaWikiServices; |
| 6 |
use MediaWiki\ResourceLoader\FileModule; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
class CiteCSSFileModule extends FileModule { |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
public function __construct( |
| 20 |
array $options = [], |
| 21 |
$localBasePath = null, |
| 22 |
$remoteBasePath = null |
| 23 |
) { |
| 24 |
$contLang = MediaWikiServices::getInstance()->getContentLanguage(); |
| 25 |
parent::__construct( $options, $localBasePath, $remoteBasePath ); |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
foreach ( [ $contLang->getCode(), ...$contLang->getFallbackLanguages() ] as $lang ) { |
| 30 |
$langStyleFile = "ext.cite.style.$lang.less"; |
| 31 |
if ( file_exists( $this->getLocalPath( $langStyleFile ) ) ) { |
| 32 |
$this->styles[] = $langStyleFile; |
| 33 |
break; |
| 34 |
} |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
} |