Manual:Hooks/OutputPageBodyAttributes
From Linux Web Expert
OutputPageBodyAttributes | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate> Called when OutputPage::headElement() is creating the body tag. | |
<translate> Define function:</translate> | public static function onOutputPageBodyAttributes( OutputPage $out, Skin $skin, &$bodyAttrs ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"OutputPageBodyAttributes": "MediaWiki\\Extension\\MyExtension\\Hooks::onOutputPageBodyAttributes"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> Output/OutputPage.php |
<translate> Interface:</translate> | OutputPageBodyAttributesHook.php |
<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:OutputPageBodyAttributes extensions</tvar>.</translate>
Details
Allows extensions to add attributes to the body of the page they might need. Or to allow building extensions to add body classes that aren't of high enough demand to be included in core.
- $out: The OutputPage which called the hook, can be used to get the real title
- $skin: The Skin that called OutputPage::headElement
- &$bodyAttrs: An array of attributes for the body tag passed to Html::openElement