Vector
Vector is a skin for MediaWiki. Vector has been the default skin on all Wikimedia wikis since 2010.
Loading...
Searching...
No Matches
MediaWiki\Skins\Vector\Hooks Class Reference
+ Inheritance diagram for MediaWiki\Skins\Vector\Hooks:
+ Collaboration diagram for MediaWiki\Skins\Vector\Hooks:

Public Member Functions

 onSkinPageReadyConfig (RL\Context $context, array &$config)
 SkinPageReadyConfig hook handler.
 
 onResourceLoaderSiteStylesModulePages ( $skin, &$pages)
 Adds MediaWiki:Vector.css as the skin style that controls classic Vector.
 
 onResourceLoaderSiteModulePages ( $skin, &$pages)
 Adds MediaWiki:Vector.css as the skin style that controls classic Vector.
 
 onGetPreferences ( $user, &$prefs)
 Adds the persistent sidebar hidden API preference.
 
 onLocalUserCreated ( $user, $isAutoCreated)
 Called one time when initializing a users preferences for a newly created account.
 
 onOutputPageBodyAttributes ( $out, $sk, &$bodyAttrs)
 Called when OutputPage::headElement is creating the body tag to allow skins and extensions to add attributes they might need to the body of the page.
 
 onRequestContextCreateSkin ( $context, &$skin)
 Temporary RequestContextCreateSkin hook handler.
 
 onMakeGlobalVariablesScript (&$vars, $out)
 NOTE: Please use ResourceLoaderGetConfigVars hook instead if possible for adding config to the page.
 

Static Public Member Functions

static getVectorResourceLoaderConfig (RL\Context $context, Config $config)
 Passes config variables to Vector (modern) ResourceLoader module.
 
static getVectorSearchResourceLoaderConfig (RL\Context $context, Config $config)
 Generates config variables for skins.vector.search Resource Loader module (defined in skin.json).
 
static makeIcon ( $name)
 Make an icon.
 
static updateDropdownMenuData ( $item)
 Updates template data for Vector dropdown menus.
 
static updateLinkData ( $item)
 Updates template data for Vector link items.
 
static updateMenuItemData ( $item)
 Updates template data for Vector menu items.
 
static onSkinTemplateNavigation ( $sk, &$content_navigation)
 Upgrades Vector's watch action to a watchstar.
 
static shouldDisableMaxWidth (array $options, Title $title, array $requestValues)
 Per the $options configuration (for use with $wgVectorMaxWidthOptions) determine whether max-width should be disabled on the page.
 

Member Function Documentation

◆ getVectorResourceLoaderConfig()

static MediaWiki\Skins\Vector\Hooks::getVectorResourceLoaderConfig ( RL\Context $context,
Config $config )
static

Passes config variables to Vector (modern) ResourceLoader module.

Parameters
RL\Context$context
Config$config
Returns
array

◆ getVectorSearchResourceLoaderConfig()

static MediaWiki\Skins\Vector\Hooks::getVectorSearchResourceLoaderConfig ( RL\Context $context,
Config $config )
static

Generates config variables for skins.vector.search Resource Loader module (defined in skin.json).

Parameters
RL\Context$context
Config$config
Returns
array<string,mixed>

◆ onGetPreferences()

MediaWiki\Skins\Vector\Hooks::onGetPreferences ( $user,
& $prefs )

Adds the persistent sidebar hidden API preference.

Parameters
User$userUser whose preferences are being modified.
array[]&$prefsPreferences description array, to be fed to a HTMLForm object.

◆ onLocalUserCreated()

MediaWiki\Skins\Vector\Hooks::onLocalUserCreated ( $user,
$isAutoCreated )

Called one time when initializing a users preferences for a newly created account.

Parameters
User$userNewly created user object.
bool$isAutoCreated

◆ onMakeGlobalVariablesScript()

MediaWiki\Skins\Vector\Hooks::onMakeGlobalVariablesScript ( & $vars,
$out )

NOTE: Please use ResourceLoaderGetConfigVars hook instead if possible for adding config to the page.

Adds config variables to JS that depend on current page/request.

Adds a config flag that can disable saving the VectorSidebarVisible user preference when the sidebar menu icon is clicked.

Parameters
array&$varsArray of variables to be added into the output.
OutputPage$outOutputPage instance calling the hook

◆ onOutputPageBodyAttributes()

MediaWiki\Skins\Vector\Hooks::onOutputPageBodyAttributes ( $out,
$sk,
& $bodyAttrs )

Called when OutputPage::headElement is creating the body tag to allow skins and extensions to add attributes they might need to the body of the page.

Parameters
OutputPage$out
Skin$sk
string[]&$bodyAttrs

◆ onRequestContextCreateSkin()

MediaWiki\Skins\Vector\Hooks::onRequestContextCreateSkin ( $context,
& $skin )

Temporary RequestContextCreateSkin hook handler.

Switches to new Vector on certain pages.

See also
https://www.mediawiki.org/wiki/Manual:Hooks/RequestContextCreateSkin
Parameters
IContextSource$contextThe RequestContext object the skin is being created for.
Skin | null | string&$skinA variable reference you may set a Skin instance or string key on to override the skin that will be used for the context.
Returns
bool|void

◆ onResourceLoaderSiteModulePages()

MediaWiki\Skins\Vector\Hooks::onResourceLoaderSiteModulePages ( $skin,
& $pages )

Adds MediaWiki:Vector.css as the skin style that controls classic Vector.

Parameters
string$skin
array&$pages

◆ onResourceLoaderSiteStylesModulePages()

MediaWiki\Skins\Vector\Hooks::onResourceLoaderSiteStylesModulePages ( $skin,
& $pages )

Adds MediaWiki:Vector.css as the skin style that controls classic Vector.

Parameters
string$skin
array&$pages

◆ onSkinPageReadyConfig()

MediaWiki\Skins\Vector\Hooks::onSkinPageReadyConfig ( RL\Context $context,
array & $config )

SkinPageReadyConfig hook handler.

Replace searchModule provided by skin.

Since
1.35
Parameters
RL\Context$context
mixed[]&$configAssociative array of configurable options
Returns
void This hook must not abort, it must return no value

◆ onSkinTemplateNavigation()

static MediaWiki\Skins\Vector\Hooks::onSkinTemplateNavigation ( $sk,
& $content_navigation )
static

Upgrades Vector's watch action to a watchstar.

This is invoked inside SkinVector, not via skin registration, as skin hooks are not guaranteed to run last. This can possibly be revised based on the outcome of T287622.

See also
https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateNavigation
Parameters
SkinTemplate$sk
array&$content_navigation

◆ shouldDisableMaxWidth()

static MediaWiki\Skins\Vector\Hooks::shouldDisableMaxWidth ( array $options,
Title $title,
array $requestValues )
static

Per the $options configuration (for use with $wgVectorMaxWidthOptions) determine whether max-width should be disabled on the page.

For the main page: Check the value of $options['exclude']['mainpage'] For all other pages, the following will happen:

  • the array $options['include'] of canonical page names will be checked against the current page. If a page has been listed there, function will return false (max-width will not be disabled) Max width is disabled if: 1) The current namespace is listed in array $options['exclude']['namespaces'] OR 2) A query string parameter matches one of the regex patterns in $exclusions['querystring'].

◆ updateDropdownMenuData()

static MediaWiki\Skins\Vector\Hooks::updateDropdownMenuData ( $item)
static

Updates template data for Vector dropdown menus.

Parameters
array$itemMenu data to update
Returns
array $item Updated menu data

◆ updateLinkData()

static MediaWiki\Skins\Vector\Hooks::updateLinkData ( $item)
static

Updates template data for Vector link items.

Parameters
array$itemlink data to update
Returns
array $item Updated link data

◆ updateMenuItemData()

static MediaWiki\Skins\Vector\Hooks::updateMenuItemData ( $item)
static

Updates template data for Vector menu items.

Parameters
array$itemmenu item data to update
Returns
array $item Updated menu item data

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