MediaWiki  1.34.0
ResourceLoaderLessModule.php
Go to the documentation of this file.
1 <?php
23 namespace Vector;
24 
25 use CSSMin;
27 use ConfigException;
30 
45  protected function getLessVars( ResourceLoaderContext $context ) {
46  $lessVars = parent::getLessVars( $context );
47  try {
48  $config = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'vector' );
49  $printLogo = $config->get( 'VectorPrintLogo' );
50  } catch ( ConfigException $e ) {
51  // Config is not available when running in the context of the MediaWiki installer. (T183640)
52  $printLogo = false;
53  }
54  if ( $printLogo ) {
55  $lessVars[ 'printLogo' ] = true;
56  $lessVars[ 'printLogoUrl' ] = CSSMin::buildUrlValue( $printLogo['url'] );
57  $lessVars[ 'printLogoWidth' ] = intval( $printLogo['width'] );
58  $lessVars[ 'printLogoHeight' ] = intval( $printLogo['height'] );
59  } else {
60  $lessVars[ 'printLogo' ] = false;
61  }
62  return $lessVars;
63  }
64 }
Vector
Definition: Hooks.php:3
ResourceLoaderContext
Context object that contains information about the state of a specific ResourceLoader web request.
Definition: ResourceLoaderContext.php:33
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:117
ResourceLoaderFileModule
Module based on local JavaScript/CSS files.
Definition: ResourceLoaderFileModule.php:35
ConfigException
Exceptions for config failures.
Definition: ConfigException.php:28
Vector\ResourceLoaderLessModule\getLessVars
getLessVars(ResourceLoaderContext $context)
Get language-specific LESS variables for this module.
Definition: ResourceLoaderLessModule.php:45
$context
$context
Definition: load.php:45
Vector\ResourceLoaderLessModule
ResourceLoader module for print styles.
Definition: ResourceLoaderLessModule.php:38