User:Jdlrobson/Skins for extension developers

Some notes around how skins will work after the changes in MediaWiki 1.35.

Q: I want to add JS/CSS specific to a skin
A: For this there are 2 mechanisms - for an already existing module, use skinScripts or skinStyles keys in ResourceLoader. For a new module you have built use the hook and  call OutputPage::addModule or OutputPage::addModuleStyles. Use the second skin parameter to limit this change to certain skins.

I want to modify the subtitle.
A: Use and clearSubtitle, getSubtitle, and addSubtitle as appropriate.

Q: I want to append something to the page title
A: Usually modifying the subtitle is a better approach but if you do have need to update the title use  and call setPageTitle

Q: I want to pass some data down to a skin rendered via BaseTemplate
A: Use OutputPage->getProperty and OutputPage->setProperty alongside one of the OutputPage hooks.

Q: I want to add a link to one of the existing sidebar menus
A: Use. This supports additions to toolbox and languages since 1.35.

Q: I want to add a link to the personal tools
A: Use the hook.

Q: I want to add a new "portal" menu to the sidebar.
A: Use.

Q: I want to add a tab alongside user page and discussion
A: Use and modify the 'namespaces' key.

Q: I want to add another article view alongside edit and history
A: Use and modify the 'views' key.

Q: I want to add another action alongside move and delete.
A: Use and modify the 'actions' key.

Q: I have a link that should only be added to certain pages e.g. special pages
A: Use the appropriate hook and inspect the Title object.

Q: I want to hide a link
Add a stylesheet to hide the component. Otherwise please make a feature request for core to provide a method of disabling.

Q: I want to add something to the footer
A: Use the hook.

Making or integrating with a new skin
When making a new skin or integrating with an existing one, please be careful around which hooks you rely on. Follow the best practices listed above. In this section I'll try and compile advice around what building blocks can be considered reliable in the long term future.

Deprecated hooks
Please avoid relying on these hooks (or using them!) during your development or at least be aware of the long term plans surrounding them.

Deprecated Vector hooks
(deprecated)


 * (used by ShoutWikiAds)
 * (used by ShoutWikiAds)

Active hooks (To organize)
(extends ContextSource)

All these hooks can be considered safe during skin development

Active hooks:


 * (to rename)
 * (to rename)
 * (to rename)
 * (to rename)
 * (to rename)
 * (to rename)
 * (to rename)
 * (to rename)
 * (to rename)
 * (to rename)
 * (to rename)
 * (to rename)
 * (to rename)
 * (to rename)
 * (to rename)

Active hooks (but currently run inside SkinTemplate)


 * (for adding to tabs, actions and views)
 * (for adding to tabs, actions and views)
 * (for adding to tabs, actions and views)