MediaWiki master
SkinFactory Class Reference

Factory class to create Skin objects. More...

Public Member Functions

 __construct (ObjectFactory $objectFactory, array $skipSkins)
 
 getAllowedSkins ()
 Get the list of user-selectable skins.
 
 getInstalledSkins ()
 Get the list of installed skins.
 
 getSkinNames ()
 Return an associative array of skin name => human readable name.
 
 getSkinOptions (string $name)
 Return options provided for a given skin name.
 
 makeSkin ( $name)
 Create a given Skin using the registered callback for $name.
 
 register ( $name, $displayName, $spec, ?bool $skippable=null)
 Register a new skin.
 

Detailed Description

Factory class to create Skin objects.

Since
1.24

Definition at line 31 of file SkinFactory.php.

Constructor & Destructor Documentation

◆ __construct()

SkinFactory::__construct ( ObjectFactory $objectFactory,
array $skipSkins )
Access: internal
For ServiceWiring only
Parameters
ObjectFactory$objectFactory
string[]$skipSkins

Definition at line 67 of file SkinFactory.php.

Member Function Documentation

◆ getAllowedSkins()

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
string[]
Since
1.36

Definition at line 156 of file SkinFactory.php.

References getInstalledSkins().

◆ getInstalledSkins()

SkinFactory::getInstalledSkins ( )

Get the list of installed skins.

Returns an associative array of skin name => human readable name

Returns
string[]
Since
1.37

Definition at line 174 of file SkinFactory.php.

Referenced by getAllowedSkins().

◆ getSkinNames()

SkinFactory::getSkinNames ( )

Return an associative array of skin name => human readable name.

Deprecated
since 1.37 Use getInstalledSkins instead
Returns
array

Definition at line 120 of file SkinFactory.php.

References wfDeprecated().

◆ getSkinOptions()

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 188 of file SkinFactory.php.

References makeSkin().

◆ makeSkin()

SkinFactory::makeSkin ( $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
Returns
Skin

Definition at line 132 of file SkinFactory.php.

Referenced by getSkinOptions().

◆ register()

SkinFactory::register ( $name,
$displayName,
$spec,
?bool $skippable = null )

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.
true | null$skippableWhether the skin is skippable and should be hidden from user preferences. By default, this is determined based by $wgSkipSkins.

Definition at line 87 of file SkinFactory.php.


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