Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 19 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| TimelessVariablesModule | |
0.00% |
0 / 19 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| getLessVars | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
6 | |||
| getDefinitionSummary | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Skin\Timeless; |
| 4 | |
| 5 | use MediaWiki\ResourceLoader\Context; |
| 6 | use MediaWiki\ResourceLoader\SkinModule; |
| 7 | |
| 8 | /** |
| 9 | * ResourceLoader module to set some LESS variables for the skin |
| 10 | */ |
| 11 | class TimelessVariablesModule extends SkinModule { |
| 12 | /** |
| 13 | * Add our LESS variables |
| 14 | * |
| 15 | * @param Context $context |
| 16 | * @return array LESS variables |
| 17 | */ |
| 18 | protected function getLessVars( Context $context ) { |
| 19 | $vars = parent::getLessVars( $context ); |
| 20 | $config = $this->getConfig(); |
| 21 | |
| 22 | // Backdrop image |
| 23 | $backdrop = $config->get( 'TimelessBackdropImage' ); |
| 24 | |
| 25 | if ( $backdrop === 'cat.svg' ) { |
| 26 | // expand default |
| 27 | $backdrop = 'images/cat.svg'; |
| 28 | } |
| 29 | |
| 30 | return array_merge( |
| 31 | $vars, |
| 32 | [ |
| 33 | 'backdrop-image' => "url($backdrop)", |
| 34 | // 'logo-image' => '' |
| 35 | // 'wordmark-image' => '' |
| 36 | // +width cutoffs ... |
| 37 | ] |
| 38 | ); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Register the config var with the caching stuff so it properly updates the cache |
| 43 | * |
| 44 | * @param Context $context |
| 45 | * @return array |
| 46 | */ |
| 47 | public function getDefinitionSummary( Context $context ) { |
| 48 | $summary = parent::getDefinitionSummary( $context ); |
| 49 | $summary[] = [ |
| 50 | 'TimelessBackdropImage' => $this->getConfig()->get( 'TimelessBackdropImage' ) |
| 51 | ]; |
| 52 | return $summary; |
| 53 | } |
| 54 | } |