Merge "New hook for filters on Special:Contributions form"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 1 Feb 2016 22:47:40 +0000 (22:47 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 1 Feb 2016 22:47:40 +0000 (22:47 +0000)
docs/hooks.txt
includes/specials/SpecialContributions.php

index a2b8592..24eb868 100644 (file)
@@ -2783,6 +2783,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
index ab6614b..1a1b490 100644 (file)
@@ -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 ),