A skin can currently add classes to the body or HTML element by the following methods:
- Overriding the class property in the array returned by Skin::getHtmlElementAttributes
- The OutputPageBodyAttributes hook.
Both methods are called within OutputPage::headElement
Looking at existing usages of getHtmlElementAttributes we see skins use it for no reason whatsoever (BlueSpiceCalumma) or to add classes to the HTML element (Vector, LiquiFlow). In the latter case, both classes could easily be added to the body tag instead.
The OutputPageBodyAttributes hook is more frequently used.
Some skins, provide their own static body classes. e.g. Apex and Astra (currently via JavaScript)
TODO
- [] Update Vector to use the OutputPageBodyAttributes to conditionally add the sticky header class (good reasons to still use HTML tag)
- [] We hard deprecate Skin::getHtmlElementAttributes and move functionality into OutputPage. (good reasons to still use HTML tag)
- Allow skins to define a skin option bodyClasses at skin registration.
e.g.
"ValidSkinNames": { "vector": { "class": "SkinVector", "@args": "See SkinVector::__construct for more detail.", "args": [ { "name": "vector", "bodyClasses": [ "skin-vector-legacy" ],
- Update Vector skin to showcase its usage.