From 7d98f486d276fc139314c7a465fa18e9bdcdb6ee Mon Sep 17 00:00:00 2001 From: Krinkle Date: Sun, 8 Jan 2012 01:49:06 +0000 Subject: [PATCH] [Skin] Add CSS hook for action ("action-.." class on body) * Fixes bug 4438 * Depends on r108342. See also r108343 which did a similar thing for mw.config wgAction Previously attempted in r91871, which was reverted in r94131. Added in OutputPage instead of Skin::getPageClasses, as this is not directly page nor skin related. It also ensures independency from skins, this CSS class should be always available so that it can be relied on by the front-end. --- RELEASE-NOTES-1.19 | 1 + includes/OutputPage.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index 0515e29801..6e45609a34 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -231,6 +231,7 @@ production. * (bug 33587) Remove action "historysubmit" from history pages. * (bug 25800) mw.config wgAction should contain the actually performed action instead of whatever the query value contains. +* (bug 4438) Add CSS hook for current WikiPage action. === API changes in 1.19 === * (bug 19838) siprop=interwikimap can now use the interwiki cache. diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 955b6a0a78..f691a0c0fd 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2380,7 +2380,8 @@ $templates * @return String: The doctype, opening , and head element. */ public function headElement( Skin $sk, $includeStyle = true ) { - global $wgContLang; + global $wgContLang, $mediaWiki; + $userdir = $this->getLanguage()->getDir(); $sitedir = $wgContLang->getDir(); @@ -2425,6 +2426,7 @@ $templates } $bodyAttrs['class'] .= ' ' . $sk->getPageClasses( $this->getTitle() ); $bodyAttrs['class'] .= ' skin-' . Sanitizer::escapeClass( $sk->getSkinName() ); + $bodyAttrs['class'] .= ' action-' . Sanitizer::escapeClass( $mediaWiki->getPerformedAction() ); $sk->addToBodyAttributes( $this, $bodyAttrs ); // Allow skins to add body attributes they need wfRunHooks( 'OutputPageBodyAttributes', array( $this, $sk, &$bodyAttrs ) ); -- 2.20.1