From: Adam Roses Wight Date: Wed, 27 Jan 2016 04:29:16 +0000 (-0800) Subject: New hook for filters on Special:Contributions form X-Git-Tag: 1.31.0-rc.0~8114^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=05da5bbea0ca0f67dc6706884e9cca3794bf9eb4;p=lhc%2Fweb%2Fwiklou.git New hook for filters on Special:Contributions form Bug: T124857 Change-Id: I56a3f13e8888202f832c5c18c92f3ff899f032f2 --- diff --git a/docs/hooks.txt b/docs/hooks.txt index 2b5e1e0d7e..9aacaa94d6 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -2793,6 +2793,11 @@ $id: User id number, only provided for backwards-compatibility $user: User object representing user contributions are being fetched for $sp: SpecialPage instance, providing context +'SpecialContributions::getForm::filters': Called with a list of filters to render +on Special:Contributions. +$sp: SpecialContributions object, for context +&$filters: List of filters rendered as HTML + 'SpecialListusersDefaultQuery': Called right before the end of UsersPager::getDefaultQuery(). $pager: The UsersPager instance diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index ab6614bc12..1a1b490c74 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -571,8 +571,10 @@ class SpecialContributions extends IncludableSpecialPage { ) ); + $filters = array(); + if ( $this->getUser()->isAllowed( 'deletedhistory' ) ) { - $deletedOnlyCheck = Html::rawElement( + $filters[] = Html::rawElement( 'span', array( 'class' => 'mw-input-with-label' ), Xml::checkLabel( @@ -583,11 +585,9 @@ class SpecialContributions extends IncludableSpecialPage { array( 'class' => 'mw-input' ) ) ); - } else { - $deletedOnlyCheck = ''; } - $checkLabelTopOnly = Html::rawElement( + $filters[] = Html::rawElement( 'span', array( 'class' => 'mw-input-with-label' ), Xml::checkLabel( @@ -598,7 +598,7 @@ class SpecialContributions extends IncludableSpecialPage { array( 'class' => 'mw-input' ) ) ); - $checkLabelNewOnly = Html::rawElement( + $filters[] = Html::rawElement( 'span', array( 'class' => 'mw-input-with-label' ), Xml::checkLabel( @@ -609,10 +609,16 @@ class SpecialContributions extends IncludableSpecialPage { array( 'class' => 'mw-input' ) ) ); + + Hooks::run( + 'SpecialContributions::getForm::filters', + array( $this, &$filters ) + ); + $extraOptions = Html::rawElement( 'td', array( 'colspan' => 2 ), - $deletedOnlyCheck . $checkLabelTopOnly . $checkLabelNewOnly + implode( '', $filters ) ); $dateSelectionAndSubmit = Xml::tags( 'td', array( 'colspan' => 2 ),