/** * @param ResourceLoaderContext $context * @return array */ public function getStyles(ResourceLoaderContext $context) { $conf = $this->getConfig(); $logo = $conf->get('Logo'); $logoHD = $conf->get('LogoHD'); $logo1 = OutputPage::transformResourcePath($conf, $logo); $logo15 = OutputPage::transformResourcePath($conf, $logoHD['1.5x']); $logo2 = OutputPage::transformResourcePath($conf, $logoHD['2x']); $styles = parent::getStyles($context); $styles['all'][] = '.mw-wiki-logo { background-image: ' . CSSMin::buildUrlValue($logo1) . '; }'; if ($logoHD) { if (isset($logoHD['1.5x'])) { $styles['(-webkit-min-device-pixel-ratio: 1.5), ' . '(min--moz-device-pixel-ratio: 1.5), ' . '(min-resolution: 1.5dppx), ' . '(min-resolution: 144dpi)'][] = '.mw-wiki-logo { background-image: ' . CSSMin::buildUrlValue($logo15) . ';' . 'background-size: 135px auto; }'; } if (isset($logoHD['2x'])) { $styles['(-webkit-min-device-pixel-ratio: 2), ' . '(min--moz-device-pixel-ratio: 2),' . '(min-resolution: 2dppx), ' . '(min-resolution: 192dpi)'][] = '.mw-wiki-logo { background-image: ' . CSSMin::buildUrlValue($logo2) . ';' . 'background-size: 135px auto; }'; } } return $styles; }
/** * @param ResourceLoaderContext $context * @return array */ public function getStyleURLsForDebug(ResourceLoaderContext $context) { if ($this->hasGeneratedStyles) { // Do the default behaviour of returning a url back to load.php // but with only=styles. return parent::getStyleURLsForDebug($context); } // Our module consists entirely of real css files, // in debug mode we can load those directly. $urls = []; foreach ($this->getStyleFiles($context) as $mediaType => $list) { $urls[$mediaType] = []; foreach ($list as $file) { $urls[$mediaType][] = OutputPage::transformResourcePath($this->getConfig(), $this->getRemotePath($file)); } } return $urls; }