Merge "Deprecate using Skin method to add body attributes."

This commit is contained in:
jenkins-bot 2020-06-22 21:23:10 +00:00 committed by Gerrit Code Review
commit a0559c63c6
3 changed files with 10 additions and 12 deletions

View file

@ -1241,6 +1241,8 @@ because of Phabricator reports.
use SidebarBeforeOutput hook instead.
* SkinTemplateToolboxEnd hook has been deprecated. Use SidebarBeforeOutput hook
instead.
* Using Skin::addToBodyAttributes() method to add body attributes has been
deprecated. Use OutputPageBodyAttributes hook instead.
* …
=== Other changes in 1.35 ===

View file

@ -3131,7 +3131,14 @@ class OutputPage extends ContextSource {
$bodyAttrs['class'] = implode( ' ', $bodyClasses );
// Allow skins and extensions to add body attributes they need
$sk->addToBodyAttributes( $this, $bodyAttrs );
// Get ones from deprecated method
if ( method_exists( $sk, 'addToBodyAttributes' ) ) {
/** @phan-suppress-next-line PhanUndeclaredMethod */
$sk->addToBodyAttributes( $this, $bodyAttrs );
wfDeprecated( 'Skin::addToBodyAttributes method to add body attributes', '1.35' );
}
// Then run the hook, the recommended way of adding body attributes now
$this->getHookRunner()->onOutputPageBodyAttributes( $this, $sk, $bodyAttrs );
$pieces[] = Html::openElement( 'body', $bodyAttrs );

View file

@ -492,17 +492,6 @@ abstract class Skin extends ContextSource {
];
}
/**
* This will be called by OutputPage::headElement when it is creating the
* "<body>" tag, skins can override it if they have a need to add in any
* body attributes or classes of their own.
* @param OutputPage $out
* @param array &$bodyAttrs
*/
public function addToBodyAttributes( $out, &$bodyAttrs ) {
// does nothing by default
}
/**
* URL to the default square logo (1x key)
* Please use ResourceLoaderSkinModule::getAvailableLogos