Manual:Hooks/PreferencesGetLayout

From mediawiki.org
PreferencesGetLayout
Available from version 1.40.0
Use the hook to check if the preferences will have a mobile or desktop layout.
Define function:
public static function onPreferencesGetLayout( bool &$useMobileLayout, string $skinName, array $skinProperties ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"PreferencesGetLayout": "MediaWiki\\Extension\\MyExtension\\Hooks::onPreferencesGetLayout"
	}
}
Called from: File(s): specials/forms/PreferencesFormOOUI.php
Interface: PreferencesGetLayoutHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:PreferencesGetLayout extensions.


Details[edit]

  • bool &$useMobileLayout: A boolean which will indicate whether to use a mobile layout or not
  • string $skinName: The name of the skin being used.
  • array $skinProperties: An associative array that includes skin properties. Is an empty array by default. A skin property could be one of the following:
    • `isResponsive`: Whether a skin can be responsive.
    • `getVersion`: Get the version of the skin.

Notes[edit]

This hook allows extensions or skins to determine whether Special:Preferences should display a mobile layout or not.

The default is that the desktop layout will be shown.

See also[edit]