Soft deprecate Skin::bottomScripts
Also prepare OutputPage::getBottomScripts to handle the work of SkinAfterBottomScripts hook in the future. Bug: T257704 Change-Id: Ib0a8b72faa88259c24b5fb7e9d5a908423494247
This commit is contained in:
parent
86fcccf0a8
commit
2d18a56d54
3 changed files with 14 additions and 3 deletions
|
|
@ -424,6 +424,7 @@ because of Phabricator reports.
|
|||
* Content::preSaveTransform was hard-deprecated since 1.37,
|
||||
use ContentTransformer::preSaveTransform instead. Extensions defining
|
||||
a content model should override ContentHandler::preSaveTransform.
|
||||
* Skin::bottomScripts is deprecated. Use OutputPage::getBottomScripts instead.
|
||||
* …
|
||||
|
||||
=== Deprecations in 1.37 ===
|
||||
|
|
|
|||
|
|
@ -3224,9 +3224,10 @@ class OutputPage extends ContextSource {
|
|||
* JS stuff to put at the bottom of the `<body>`.
|
||||
* These are legacy scripts ($this->mScripts), and user JS.
|
||||
*
|
||||
* @param string $extraHtml (only for use by this->tailElement(); will be removed in future)
|
||||
* @return string|WrappedStringList HTML
|
||||
*/
|
||||
public function getBottomScripts() {
|
||||
public function getBottomScripts( $extraHtml = '' ) {
|
||||
$chunks = [];
|
||||
$chunks[] = $this->getRlClient()->getBodyHtml();
|
||||
|
||||
|
|
@ -3241,6 +3242,10 @@ class OutputPage extends ContextSource {
|
|||
$this->CSP->getNonce()
|
||||
);
|
||||
}
|
||||
// This should be added last because the extra html comes from
|
||||
// SkinAfterBottomScripts hook.
|
||||
// TODO: Run the hook here directly and remove the parameter.
|
||||
$chunks[] = $extraHtml;
|
||||
|
||||
return self::combineWrappedStrings( $chunks );
|
||||
}
|
||||
|
|
@ -4212,9 +4217,14 @@ class OutputPage extends ContextSource {
|
|||
* @return string
|
||||
*/
|
||||
public function tailElement( $skin ) {
|
||||
// T257704: Temporarily run skin hook here pending
|
||||
// creation dedicated outputpage hook for this
|
||||
$extraHtml = '';
|
||||
$this->getHookRunner()->onSkinAfterBottomScripts( $skin, $extraHtml );
|
||||
|
||||
$tail = [
|
||||
MWDebug::getDebugHTML( $skin ),
|
||||
$skin->bottomScripts(),
|
||||
$this->getBottomScripts( $extraHtml ),
|
||||
wfReportTime( $this->getCSP()->getNonce() ),
|
||||
MWDebug::getHTMLDebugLog()
|
||||
. Html::closeElement( 'body' )
|
||||
|
|
|
|||
|
|
@ -714,7 +714,7 @@ abstract class Skin extends ContextSource {
|
|||
|
||||
/**
|
||||
* This gets called shortly before the "</body>" tag.
|
||||
*
|
||||
* @deprecated since 1.37
|
||||
* @return string|WrappedStringList HTML containing scripts to put before `</body>`
|
||||
*/
|
||||
public function bottomScripts() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue