Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -1193,6 +1193,14 @@ |
1194 | 1194 | $parserOutput: the parserOutput (object) that corresponds to the page |
1195 | 1195 | $text: the text that will be displayed, in HTML (string) |
1196 | 1196 | |
| 1197 | +'OutputPageBodyAttrs': called when OutputPage::headElement is creating the body |
| 1198 | +tag to allow for extensions to add attributes to the body of the page they might |
| 1199 | +need. Or to allow building extensions to add body classes that aren't of high |
| 1200 | +enough demand to be included in core. |
| 1201 | +$out: The OutputPage which called the hook, can be used to get the real title |
| 1202 | +$sk: The Skin that called OutputPage::headElement |
| 1203 | +&$bodyAttrs: An array of attributes for the body tag passed to Html::openElement |
| 1204 | + |
1197 | 1205 | 'OutputPageCheckLastModified': when checking if the page has been modified |
1198 | 1206 | since the last visit |
1199 | 1207 | &$modifiedTimes: array of timestamps. |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -568,6 +568,15 @@ |
569 | 569 | |
570 | 570 | return "$numeric $type $name"; |
571 | 571 | } |
| 572 | + |
| 573 | + /** |
| 574 | + * This will be called by OutputPage::headElement when it is creating the |
| 575 | + * <body> tag, skins can override it if they have a need to add in any |
| 576 | + * body attributes or classes of their own. |
| 577 | + */ |
| 578 | + function bodyAttributes( $out, &$bodyAttrs ) { |
| 579 | + // does nothing by default |
| 580 | + } |
572 | 581 | |
573 | 582 | /** |
574 | 583 | * URL to the logo |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -2276,6 +2276,9 @@ |
2277 | 2277 | $bodyAttrs['class'] .= ' ' . Sanitizer::escapeClass( 'page-' . $this->getTitle()->getPrefixedText() ); |
2278 | 2278 | $bodyAttrs['class'] .= ' skin-' . Sanitizer::escapeClass( $wgUser->getSkin()->getSkinName() ); |
2279 | 2279 | |
| 2280 | + $sk->bodyAttributes( $this, $bodyAttrs ); // Allow skins to add body attributes they need |
| 2281 | + wfRunHooks( 'OutputPageBodyAttrs', array( $this, $sk, &$bodyAttrs ) ); |
| 2282 | + |
2280 | 2283 | $ret .= Html::openElement( 'body', $bodyAttrs ) . "\n"; |
2281 | 2284 | |
2282 | 2285 | return $ret; |