MediaWiki master
MediaWiki\Skin\SkinFactory Class Reference

Factory class to create Skin objects. More...

Public Member Functions

 __construct (private readonly ObjectFactory $objectFactory, private readonly array $skipSkins)
 
 getAllowedSkins ()
 Get the list of user-selectable skins.
 
 getInstalledSkins ()
 
 getSkinOptions (string $name)
 Return options provided for a given skin name.
 
 makeSkin (string $name)
 Create a given Skin using the registered callback for $name.
 
 register (string $name, string $displayName, $spec, bool $skippable=false)
 Register a new skin.
 

Detailed Description

Factory class to create Skin objects.

Since
1.24

Definition at line 20 of file SkinFactory.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Skin\SkinFactory::__construct ( private readonly ObjectFactory $objectFactory,
private readonly array $skipSkins )
Access: internal
For ServiceWiring only
Parameters
ObjectFactory$objectFactory
string[]$skipSkinsSkins that should not be presented in the list of available skins in user preferences, while they're still installed.

Definition at line 46 of file SkinFactory.php.

Member Function Documentation

◆ getAllowedSkins()

MediaWiki\Skin\SkinFactory::getAllowedSkins ( )

Get the list of user-selectable skins.

Useful for Special:Preferences and other places where you only want to show skins users can select from preferences page, thus excluding those as configured by $wgSkipSkins.

Returns
array<string,string> Map of internal skin name to human-readable label
Since
1.36

Definition at line 116 of file SkinFactory.php.

◆ getInstalledSkins()

MediaWiki\Skin\SkinFactory::getInstalledSkins ( )
Returns
array<string,string> Map of internal skin name to human-readable label
Since
1.37

Definition at line 127 of file SkinFactory.php.

◆ getSkinOptions()

MediaWiki\Skin\SkinFactory::getSkinOptions ( string $name)

Return options provided for a given skin name.

For documentation about keys you can expect to exist, and their default values, refer to the Skin constructor.

Since
1.38
Parameters
string$nameName of the skin you want options from
Returns
array

Definition at line 141 of file SkinFactory.php.

◆ makeSkin()

MediaWiki\Skin\SkinFactory::makeSkin ( string $name)

Create a given Skin using the registered callback for $name.

Parameters
string$nameName of the skin you want
Exceptions
SkinExceptionIf a factory function isn't registered for $name

Definition at line 92 of file SkinFactory.php.

◆ register()

MediaWiki\Skin\SkinFactory::register ( string $name,
string $displayName,
$spec,
bool $skippable = false )

Register a new skin.

This will replace any previously registered skin by the same name.

Parameters
string$nameInternal skin name. See also Skin::__construct.
string$displayNameFor backwards-compatibility with old skin loading system. This is the text used as skin's human-readable name when the 'skinname-<skin>' message is not available.
array | callable$specObjectFactory spec to construct a Skin object, or callback that takes a skin name and returns a Skin object. See Skin::__construct for the constructor arguments.
bool$skippableWhether the skin is marked as "skippable": true and should be hidden from user preferences. By default, this is determined based by $wgSkipSkins.

Definition at line 67 of file SkinFactory.php.


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