Vector
Vector is a skin for MediaWiki. Vector has been the default skin on all Wikimedia wikis since 2010.
Vector\Hooks Class Reference

Static Public Member Functions

static getVectorResourceLoaderConfig (ResourceLoaderContext $context, Config $config)
 Passes config variables to Vector (modern) ResourceLoader module. More...
 
static getVectorWvuiSearchResourceLoaderConfig (ResourceLoaderContext $context, Config $config)
 Passes config variables to skins.vector.search ResourceLoader module. More...
 
static onSkinPageReadyConfig (ResourceLoaderContext $context, array &$config)
 SkinPageReadyConfig hook handler. More...
 
static onSkinTemplateNavigation ( $sk, &$content_navigation)
 Upgrades Vector's watch action to a watchstar. More...
 
static onGetPreferences (User $user, array &$prefs)
 Add Vector preferences to the user's Special:Preferences page directly underneath skins. More...
 
static onPreferencesFormPreSave (array $formData, HTMLForm $form, User $user, &$result, $oldPreferences)
 Hook executed on user's Special:Preferences form save. More...
 
static onLocalUserCreated (User $user, $isAutoCreated)
 Called one time when initializing a users preferences for a newly created account. More...
 
static onOutputPageBodyAttributes (OutputPage $out, Skin $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. More...
 
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. More...
 
static onMakeGlobalVariablesScript (&$vars, OutputPage $out)
 NOTE: Please use ResourceLoaderGetConfigVars hook instead if possible for adding config to the page. More...
 

Member Function Documentation

◆ getVectorResourceLoaderConfig()

static Vector\Hooks::getVectorResourceLoaderConfig ( ResourceLoaderContext  $context,
Config  $config 
)
static

Passes config variables to Vector (modern) ResourceLoader module.

Parameters
ResourceLoaderContext$context
Config$config
Returns
array

◆ getVectorWvuiSearchResourceLoaderConfig()

static Vector\Hooks::getVectorWvuiSearchResourceLoaderConfig ( ResourceLoaderContext  $context,
Config  $config 
)
static

Passes config variables to skins.vector.search ResourceLoader module.

Parameters
ResourceLoaderContext$context
Config$config
Returns
array

◆ onGetPreferences()

static Vector\Hooks::onGetPreferences ( User  $user,
array &  $prefs 
)
static

Add Vector preferences to the user's Special:Preferences page directly underneath skins.

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

◆ onLocalUserCreated()

static Vector\Hooks::onLocalUserCreated ( User  $user,
  $isAutoCreated 
)
static

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

Parameters
User$userNewly created user object.
bool$isAutoCreated

◆ onMakeGlobalVariablesScript()

static Vector\Hooks::onMakeGlobalVariablesScript ( $vars,
OutputPage  $out 
)
static

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()

static Vector\Hooks::onOutputPageBodyAttributes ( OutputPage  $out,
Skin  $sk,
$bodyAttrs 
)
static

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

◆ onPreferencesFormPreSave()

static Vector\Hooks::onPreferencesFormPreSave ( array  $formData,
HTMLForm  $form,
User  $user,
$result,
  $oldPreferences 
)
static

Hook executed on user's Special:Preferences form save.

This is used to convert the boolean presentation of skin version to a version string. That is, a single preference change by the user may trigger two writes: a boolean followed by a string.

Parameters
array$formDataForm data submitted by user
HTMLForm$formA preferences form
User$userLogged-in user
bool&$resultVariable defining is form save successful
array$oldPreferences

◆ onSkinPageReadyConfig()

static Vector\Hooks::onSkinPageReadyConfig ( ResourceLoaderContext  $context,
array &  $config 
)
static

SkinPageReadyConfig hook handler.

Replace searchModule provided by skin.

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

◆ onSkinTemplateNavigation()

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

Upgrades Vector's watch action to a watchstar.

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

◆ shouldDisableMaxWidth()

static 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) The query string matches one of the name and value pairs $exclusions['querystring']. Note the wildcard "*" for a value, will match all query string values for the given query string parameter.

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