Matmarex has uploaded a new change for review.
https://gerrit.wikimedia.org/r/60272
Change subject: Clean up the class building logic in OutputPage
......................................................................
Clean up the class building logic in OutputPage
Build the classes using an array that is finally imploded, instead of
concatenating strings repeatedly.
Change-Id: I2a09282d5ba33f131a4311c58e49dab5eefce418
---
M includes/OutputPage.php
1 file changed, 16 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/72/60272/1
diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index bf3c084..c98ef2e 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -2506,20 +2506,29 @@
$ret .= "$closeHead\n";
}
- $bodyAttrs = array();
+ $bodyClasses = array();
+ $bodyClasses[] = 'mediawiki';
# Classes for LTR/RTL directionality support
- $bodyAttrs['class'] = "mediawiki $userdir sitedir-$sitedir";
+ $bodyClasses[] = $userdir;
+ $bodyClasses[] = "sitedir-$sitedir";
if ( $this->getLanguage()->capitalizeAllNouns() ) {
# A <body> class is probably not the best way to do
this . . .
- $bodyAttrs['class'] .= ' capitalize-all-nouns';
+ $bodyClasses[] = 'capitalize-all-nouns';
}
- $bodyAttrs['class'] .= ' ' . $sk->getPageClasses(
$this->getTitle() );
- $bodyAttrs['class'] .= ' skin-' . Sanitizer::escapeClass(
$sk->getSkinName() );
- $bodyAttrs['class'] .= ' action-' . Sanitizer::escapeClass(
Action::getActionName( $this->getContext() ) );
- $sk->addToBodyAttributes( $this, $bodyAttrs ); // Allow skins
to add body attributes they need
+ $bodyClasses[] = $sk->getPageClasses( $this->getTitle() );
+ $bodyClasses[] = 'skin-' . Sanitizer::escapeClass(
$sk->getSkinName() );
+ $bodyClasses[] = 'action-' . Sanitizer::escapeClass(
Action::getActionName( $this->getContext() ) );
+
+ $bodyAttrs = array();
+ // While the implode() is not strictly needed, it's used for
backwards compatibility
+ // (this used to be built as a string and hooks likely still
expect that).
+ $bodyAttrs['class'] = implode( ' ', $bodyClasses );
+
+ // Allow skins and extensions to add body attributes they need
+ $sk->addToBodyAttributes( $this, $bodyAttrs );
wfRunHooks( 'OutputPageBodyAttributes', array( $this, $sk,
&$bodyAttrs ) );
$ret .= Html::openElement( 'body', $bodyAttrs ) . "\n";
--
To view, visit https://gerrit.wikimedia.org/r/60272
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2a09282d5ba33f131a4311c58e49dab5eefce418
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Matmarex <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits