Make the 'other' option superessable in getSuggestedDurations
authorHuji Lee <huji.huji@gmail.com>
Mon, 30 Apr 2018 01:38:42 +0000 (21:38 -0400)
committerHuji <huji.huji@gmail.com>
Tue, 24 Jul 2018 15:41:34 +0000 (15:41 +0000)
Bug: T193364
Change-Id: Ic2dbc961f7eebad11da53724b9cce2f804ffad39

includes/specials/SpecialBlock.php

index 92c6f50..3b25c6c 100644 (file)
@@ -854,9 +854,11 @@ class SpecialBlock extends FormSpecialPage {
         *     to the standard "**<duration>|<displayname>" format?
         * @param Language|null $lang The language to get the durations in, or null to use
         *     the wiki's content language
+        * @param bool $includeOther Whether to include the 'other' option in the list of
+        *     suggestions
         * @return array
         */
-       public static function getSuggestedDurations( $lang = null ) {
+       public static function getSuggestedDurations( $lang = null, $includeOther = true ) {
                $a = [];
                $msg = $lang === null
                        ? wfMessage( 'ipboptions' )->inContentLanguage()->text()
@@ -875,7 +877,7 @@ class SpecialBlock extends FormSpecialPage {
                        $a[$show] = $value;
                }
 
-               if ( $a ) {
+               if ( $a && $includeOther ) {
                        // if options exist, add other to the end instead of the begining (which
                        // is what happens by default).
                        $a[ wfMessage( 'ipbother' )->text() ] = 'other';