Mattflaschen has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/377201 )
Change subject: Add <body> class marking whether RCFilters is enabled ...................................................................... Add <body> class marking whether RCFilters is enabled Also added OutputPage->addBodyClasses to allow this Bug: T175062 Change-Id: I2111d0762328f2e59038c92d63583a9bb267fc9f --- M includes/OutputPage.php M includes/specialpage/ChangesListSpecialPage.php 2 files changed, 21 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/01/377201/1 diff --git a/includes/OutputPage.php b/includes/OutputPage.php index b71ae89..9ca42b9 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -139,6 +139,9 @@ /** @var array Array of elements in "<head>". Parser might add its own headers! */ protected $mHeadItems = []; + /** @var array Additional <body> classes; there are also <body> classes from other sources */ + protected $mAdditionalBodyClasses = []; + /** @var array */ protected $mModules = []; @@ -703,6 +706,16 @@ */ public function hasHeadItem( $name ) { return isset( $this->mHeadItems[$name] ); + } + + /** + * Add a class to the <body> element + * + * @since 1.30 + * @param string|string[] $classes One or more classes to add + */ + public function addBodyClasses( $classes ) { + $this->mAdditionalBodyClasses = array_merge( $this->mAdditionalBodyClasses, (array) $classes ); } /** @@ -2923,7 +2936,7 @@ $pieces[] = Html::closeElement( 'head' ); - $bodyClasses = []; + $bodyClasses = $this->mAdditionalBodyClasses; $bodyClasses[] = 'mediawiki'; # Classes for LTR/RTL directionality support diff --git a/includes/specialpage/ChangesListSpecialPage.php b/includes/specialpage/ChangesListSpecialPage.php index d943d03..7f6fdf7 100644 --- a/includes/specialpage/ChangesListSpecialPage.php +++ b/includes/specialpage/ChangesListSpecialPage.php @@ -573,16 +573,20 @@ /** * Include the modules and configuration for the RCFilters app. * Conditional on the user having the feature enabled. + * + * If it is disabled, add a <body> class marking that */ protected function includeRcFiltersApp() { + $out = $this->getOutput(); if ( $this->isStructuredFilterUiEnabled() ) { - $out = $this->getOutput(); $jsData = $this->getStructuredFilterJsData(); $messages = []; foreach ( $jsData['messageKeys'] as $key ) { $messages[$key] = $this->msg( $key )->plain(); } + + $out->addBodyClasses( 'mw-rcfilters-enabled' ); $out->addHTML( ResourceLoader::makeInlineScript( @@ -616,6 +620,8 @@ 'daysDefault' => $this->getDefaultDays(), ] ); + } else { + $out->addBodyClasses( 'mw-rcfilters-disabled' ); } } -- To view, visit https://gerrit.wikimedia.org/r/377201 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2111d0762328f2e59038c92d63583a9bb267fc9f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Mattflaschen <mflasc...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits