* @todo Should be in Block.php?
* @param string $par Subpage parameter passed to setup, or data value from
* the HTMLForm
- * @param WebRequest $request Optionally try and get data from a request too
+ * @param WebRequest|null $request Optionally try and get data from a request too
* @return array [ User|string|null, Block::TYPE_ constant|null ]
*/
public static function getTargetAndType( $par, WebRequest $request = null ) {
* 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( Language $lang = null, $includeOther = true ) {
$a = [];
$msg = $lang === null
? wfMessage( 'ipboptions' )->inContentLanguage()->text()
$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';
/**
* Process the form on POST submission.
* @param array $data
- * @param HTMLForm $form
+ * @param HTMLForm|null $form
* @return bool|array True for success, false for didn't-try, array of errors on failure
*/
public function onSubmit( array $data, HTMLForm $form = null ) {