Page MenuHomePhabricator

Allow skins to optimize the data the template receives.
Open, MediumPublic

Description

Much of the data in SkinTemplate::getTemplateData is unused. This is particularly prevalent in skins which do not render menus (e.g. SkinAPI) as data for menus is generated that is never rendered.

We want to be able to make breaking changes to the array returned by Skin::getTemplateData - this will result in removing certain array keys from the returned data object. This will cut down on PHP processing time and result in a more data orientated format which does not include raw HTML string.

For example

  • menu items generate a string html-items for legacy skins and also a more preferable array-items (used by SkinVector)
  • link-mainpage is generated inside SkinTemplate::
  • the SkinMustache::getCategories generates a template variable html-categories, but it also generates a data format inside data-portlets that gives more flexibility to the skin (https://github.com/wikimedia/mediawiki-skins-cli/blob/main/components/CategoryPortlet.mustache for example). On the long term we plan to port Vector to this format.

Ideas

Idea 1

Allow skin versioning
https://gerrit.wikimedia.org/r/c/mediawiki/core/+/894732

Idea 2

Allow skins to provide a list of keys that they want to generate or not generate (e.g. an inclusion/exclusion list)

Event Timeline

Change 894732 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] Skins: Allow versioning of skin data

https://gerrit.wikimedia.org/r/894732

Jdlrobson renamed this task from Allow versioning of Skin data to Allow skins to optimize the data the template receives..Nov 29 2023, 1:07 AM
Jdlrobson updated the task description. (Show Details)

Change 894732 abandoned by Jdlrobson:

[mediawiki/core@master] [POC] Skins: Allow versioning of skin data

Reason:

Not working on this right now. See also https://phabricator.wikimedia.org/T331360

https://gerrit.wikimedia.org/r/894732

Likely not a web team thing going forward and needs to be handled on platform level.

Change #1225004 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] Do not generate namespaces menu if not requested by skin

https://gerrit.wikimedia.org/r/1225004

Change #1236381 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/MinervaNeue@master] Correct declare menus Minerva uses

https://gerrit.wikimedia.org/r/1236381

Change #1236381 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] Correct declare menus Minerva uses

https://gerrit.wikimedia.org/r/1236381

Change #1225004 abandoned by Jdlrobson:

[mediawiki/core@master] [DONOTMERGE/Future] WIP: Remove support for legacy menus and optimize

Reason:

Help on this would be appreciated! https://phabricator.wikimedia.org/T423357

https://gerrit.wikimedia.org/r/1225004