[Skin] Add CSS hook for action ("action-.." class on body)
authorKrinkle <krinkle@users.mediawiki.org>
Sun, 8 Jan 2012 01:49:06 +0000 (01:49 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Sun, 8 Jan 2012 01:49:06 +0000 (01:49 +0000)
* 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
includes/OutputPage.php

index 0515e29..6e45609 100644 (file)
@@ -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.
index 955b6a0..f691a0c 100644 (file)
@@ -2380,7 +2380,8 @@ $templates
         * @return String: The doctype, opening <html>, 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 ) );