MediaWiki  master
MediaWiki\ResourceLoader\LessVarFileModule Class Reference

Module augmented with context-specific LESS variables. More...

Inheritance diagram for MediaWiki\ResourceLoader\LessVarFileModule:
Collaboration diagram for MediaWiki\ResourceLoader\LessVarFileModule:

Public Member Functions

 __construct (array $options=[], $localBasePath=null, $remoteBasePath=null)
 
 getMessages ()
 Get message keys used by this module.
Returns
string[] List of message keys
More...
 
- Public Member Functions inherited from MediaWiki\ResourceLoader\FileModule
 __construct (array $options=[], string $localBasePath=null, string $remoteBasePath=null)
 Constructs a new module from an options array. More...
 
 enableModuleContentVersion ()
 Disable module content versioning. More...
 
 getAllStyleFiles ()
 Returns all style files and all skin style files used by this module. More...
 
 getDefinitionSummary (Context $context)
 Get the definition summary for this module. More...
 
 getDependencies (Context $context=null)
 Get names of modules this module depends on. More...
 
 getFlip (Context $context)
 Get whether CSS for this module should be flipped. More...
 
 getGroup ()
 Get the name of the group this module should be loaded in. More...
 
 getPackageFiles (Context $context)
 Resolve the package files definition and generates the content of each package file. More...
 
 getScript (Context $context)
 Gets all scripts for a given context concatenated together. More...
 
 getScriptURLsForDebug (Context $context)
 
 getSkipFunction ()
 
 getStyleFiles (Context $context)
 Get a list of file paths for all styles in this module, in order of proper inclusion. More...
 
 getStyles (Context $context)
 Get all styles for a given context. More...
 
 getStyleSheetLang ( $path)
 Infer the stylesheet language from a stylesheet file path. More...
 
 getStyleURLsForDebug (Context $context)
 
 getTargets ()
 Get target(s) for the module, eg ['desktop'] or ['desktop', 'mobile']. More...
 
 getTemplates ()
 Get content of named templates for this module. More...
 
 getType ()
 Get the module's load type. More...
 
 readStyleFiles (array $styles, Context $context)
 Read the contents of a list of CSS files and remap and concatenate these. More...
 
 requiresES6 ()
 Whether the module requires ES6 support in the client. More...
 
 setSkinStylesOverride (array $moduleSkinStyles)
 Provide overrides for skinStyles to modules that support that. More...
 
 supportsURLLoading ()
 
- Public Member Functions inherited from MediaWiki\ResourceLoader\Module
 getConfig ()
 
 getDeprecationInformation (Context $context)
 Get JS representing deprecation information for the current module if available. More...
 
 getHeaders (Context $context)
 Get headers to send as part of a module web response. More...
 
 getModuleContent (Context $context)
 Get an array of this module's resources. More...
 
 getName ()
 Get this module's name. More...
 
 getOrigin ()
 Get this module's origin. More...
 
 getSkins ()
 Get list of skins for which this module must be available to load. More...
 
 getSource ()
 Get the source of this module. More...
 
 getVersionHash (Context $context)
 Get a string identifying the current version of this module in a given context. More...
 
 isKnownEmpty (Context $context)
 Check whether this module is known to be empty. More...
 
 setConfig (Config $config)
 
 setDependencyAccessCallbacks (callable $loadCallback, callable $saveCallback)
 Inject the functions that load/save the indirect file path dependency list from storage. More...
 
 setFileDependencies (Context $context, array $paths)
 Set the indirect dependencies for this module pursuant to the skin/language context. More...
 
 setHookContainer (HookContainer $hookContainer)
 
 setLogger (LoggerInterface $logger)
 
 setMessageBlob ( $blob, $lang)
 Set in-object cache for message blobs. More...
 
 setName ( $name)
 Set this module's name. More...
 
 shouldEmbedModule (Context $context)
 Check whether this module should be embedded rather than linked. More...
 

Protected Member Functions

 getLessVars (Context $context)
 Get language-specific LESS variables for this module. More...
 
 getMessageBlob (Context $context)
 Get the hash of the message blob.
Stability: stable
to override
Since
1.27
Parameters
Context$context
Returns
string|null JSON blob or null if module has no messages
More...
 
- Protected Member Functions inherited from MediaWiki\ResourceLoader\FileModule
 compileLessString ( $style, $stylePath, Context $context)
 Compile a LESS string into CSS. More...
 
 getAllSkinStyleFiles ()
 Gets a list of file paths for all skin style files in the module, for all available skins. More...
 
 getLocalPath ( $path)
 
 getPath ( $path)
 
 getRemotePath ( $path)
 
 getSkinStyleFiles ( $skinName)
 Gets a list of file paths for all skin styles in the module used by the skin. More...
 
 getVueComponentParser ()
 
 processStyle ( $style, $styleLang, $path, Context $context)
 Process a CSS/LESS string. More...
 
 readStyleFile ( $path, Context $context)
 Read and process a style file. More...
 
 stripBom ( $input)
 Takes an input string and removes the UTF-8 BOM character if present. More...
 
- Protected Member Functions inherited from MediaWiki\ResourceLoader\Module
 buildContent (Context $context)
 Bundle all resources attached to this module into an array. More...
 
 getFileDependencies (Context $context)
 Get the indirect dependencies for this module pursuant to the skin/language context. More...
 
 getHookRunner ()
 Get a HookRunner for running core hooks. More...
 
 getLogger ()
 
 getPreloadLinks (Context $context)
 Get a list of resources that web browsers may preload. More...
 
 saveFileDependencies (Context $context, array $curFileRefs)
 Save the indirect dependencies for this module pursuant to the skin/language context. More...
 
 validateScriptFile ( $fileName, $contents)
 Validate a user-provided JavaScript blob. More...
 

Protected Attributes

 $lessVariables = []
 
- Protected Attributes inherited from MediaWiki\ResourceLoader\FileModule
bool $debugRaw = true
 Link to raw files in debug mode. More...
 
array< int, string|FilePath$debugScripts = []
 List of paths to JavaScript files to include in debug mode. More...
 
string[] $dependencies = []
 List of modules this module depends on. More...
 
bool $es6 = false
 Whether this module requires the client to support ES6. More...
 
null string $group = null
 Name of group to load this module in. More...
 
bool $hasGeneratedStyles = false
 Whether getStyleURLsForDebug should return raw file paths, or return load.php urls. More...
 
array< string, array< int, string|FilePath > > $languageScripts = []
 Lists of JavaScript files by language code. More...
 
string $localBasePath = ''
 Local base path, see __construct() More...
 
string[] $localFileRefs = []
 Place where readStyleFile() tracks file dependencies. More...
 
string[] $messages = []
 List of message keys used by this module. More...
 
string[] $missingLocalFileRefs = []
 Place where readStyleFile() tracks file dependencies for non-existent files. More...
 
bool $noflip = false
 Whether CSSJanus flipping should be skipped for this module. More...
 
null array $packageFiles = null
 Packaged files definition, to bundle and make available client-side via require(). More...
 
string $remoteBasePath = ''
 Remote base path, see __construct() More...
 
array< int, string|FilePath$scripts = []
 List of JavaScript file paths to always include. More...
 
array< string, array< int, string|FilePath > > $skinScripts = []
 Lists of JavaScript files by skin name. More...
 
array< string, array< int, string|FilePath > > $skinStyles = []
 Lists of CSS files by skin name. More...
 
null string $skipFunction = null
 File name containing the body of the skip function. More...
 
array< int, string|FilePath$styles = []
 List of CSS file files to always include. More...
 
array< int|string, string|FilePath$templates = []
 List of the named templates used by this module. More...
 
VueComponentParser null $vueComponentParser = null
 Lazy-created by getVueComponentParser() More...
 
- Protected Attributes inherited from MediaWiki\ResourceLoader\Module
Config $config
 
array $contents = []
 Map of (context hash => cached module content) More...
 
string bool $deprecated = false
 Deprecation string or true if deprecated; false otherwise. More...
 
array $fileDeps = []
 Map of (variant => indirect file dependencies) More...
 
LoggerInterface $logger
 
array $msgBlobs = []
 Map of (language => in-object cache for message blob) More...
 
string null $name = null
 Module name. More...
 
int $origin = self::ORIGIN_CORE_SITEWIDE
 Script and style modules form a hierarchy of trustworthiness, with core modules like skins and jQuery as most trustworthy, and user scripts as least trustworthy. More...
 
string[] null $skins = null
 Skin names. More...
 
string[] $targets = [ 'desktop', 'mobile' ]
 What client platforms the module targets (e.g. More...
 
array $versionHash = []
 Map of (context hash => cached module version hash) More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MediaWiki\ResourceLoader\FileModule
static extractBasePaths (array $options=[], $localBasePath=null, $remoteBasePath=null)
 Extract a pair of local and remote base paths from module definition information. More...
 
static getPackageFileType ( $path)
 Infer the file type from a package file path. More...
 
- Static Public Member Functions inherited from MediaWiki\ResourceLoader\Module
static expandRelativePaths (array $filePaths)
 Expand directories relative to $IP. More...
 
static getRelativePaths (array $filePaths)
 Make file paths relative to MediaWiki directory. More...
 
static getVary (Context $context)
 Get vary string. More...
 
- Static Protected Member Functions inherited from MediaWiki\ResourceLoader\FileModule
static tryForKey (array $list, $key, $fallback=null)
 Get a list of element that match a key, optionally using a fallback key. More...
 
- Static Protected Member Functions inherited from MediaWiki\ResourceLoader\Module
static safeFileHash ( $filePath)
 Compute a non-cryptographic string hash of a file's contents. More...
 

Detailed Description

Module augmented with context-specific LESS variables.

Since
1.32

Definition at line 33 of file LessVarFileModule.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\ResourceLoader\LessVarFileModule::__construct ( array  $options = [],
  $localBasePath = null,
  $remoteBasePath = null 
)

Member Function Documentation

◆ getLessVars()

MediaWiki\ResourceLoader\LessVarFileModule::getLessVars ( Context  $context)
protected

Get language-specific LESS variables for this module.

Parameters
Context$context
Returns
array LESS variables

Reimplemented from MediaWiki\ResourceLoader\Module.

Reimplemented in MediaWiki\ResourceLoader\SkinModule.

Definition at line 118 of file LessVarFileModule.php.

References $blob.

◆ getMessageBlob()

MediaWiki\ResourceLoader\LessVarFileModule::getMessageBlob ( Context  $context)
protected

Get the hash of the message blob.

Stability: stable
to override
Since
1.27
Parameters
Context$context
Returns
string|null JSON blob or null if module has no messages

Reimplemented from MediaWiki\ResourceLoader\Module.

Definition at line 75 of file LessVarFileModule.php.

References $blob.

◆ getMessages()

MediaWiki\ResourceLoader\LessVarFileModule::getMessages ( )

Get message keys used by this module.

Returns
string[] List of message keys

Reimplemented from MediaWiki\ResourceLoader\FileModule.

Definition at line 53 of file LessVarFileModule.php.

Member Data Documentation

◆ $lessVariables

MediaWiki\ResourceLoader\LessVarFileModule::$lessVariables = []
protected

Definition at line 34 of file LessVarFileModule.php.


The documentation for this class was generated from the following file: