This repository has been archived by the owner on Jun 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
ResourceLoaderCavendishSkinModule.php
75 lines (69 loc) · 1.66 KB
/
ResourceLoaderCavendishSkinModule.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* ResourceLoader module for the Cavendish skin.
*
* @file
*/
class ResourceLoaderCavendishSkinModule extends ResourceLoaderModule {
/**
* Get all CSS for this module for a given skin.
*
* @param ResourceLoaderContext $context
* @return array List of CSS strings or array of CSS strings keyed by media type.
* like [ 'screen' => '.foo { width: 0 }' ];
* or [ 'screen' => [ '.foo { width: 0 }' ] ];
*/
public function getStyles( ResourceLoaderContext $context ) {
$config = ConfigFactory::getDefaultInstance()->makeConfig( 'cavendish' );
$logoURL = $config->get( 'CavendishLogoURL' );
$logoWidth = $config->get( 'CavendishLogoWidth' );
$logoHeight = $config->get( 'CavendishLogoHeight' );
$logoMargin = $config->get( 'CavendishLogoMargin' );
$siteWidth = $config->get( 'CavendishSiteWidth' );
$qrCodeMode = $config->get( 'CavendishQRCodeMode' );
$styles = <<<STYLES
#header h6 a {
background-color: transparent;
background-image: url("{$logoURL}");
background-repeat: no-repeat;
width: {$logoWidth}px;
height: {$logoHeight}px;
margin-top: {$logoMargin}px;
}
STYLES;
$styles .= "\n\n";
if ( $siteWidth ) {
$styles .= <<<STYLES
#globalWrapper {
width: {$siteWidth}px;
}
STYLES;
$styles .= "\n\n";
}
if ( $config->get( 'CavendishSidebarSearchbox' ) ) {
$styles .= <<<STYLES
#nav #p-search {
display: none;
}
STYLES;
$styles .= "\n\n";
}
if ( $qrCodeMode == 'all' ) {
$styles .= <<<STYLES
#f-poweredbyico {
display: none;
}
STYLES;
$styles .= "\n\n";
}
if ( $qrCodeMode == 'print' ) {
$styles .= <<<STYLES
#qrcode {
display: none;
}
STYLES;
$styles .= "\n\n";
}
return [ 'screen' => $styles ];
}
}