$this->getContext(),
$this->getMessagePrefix()
);
- $form->setSubmitCallback( array( $this, 'onSubmit' ) );
+ $form->setSubmitCallback( [ $this, 'onSubmit' ] );
if ( $this->getDisplayFormat() !== 'ooui' ) {
// No legend and wrapper by default in OOUI forms, but can be set manually
// from alterForm()
$form->addHeaderText( $headerMsg->parseAsBlock() );
}
- // Retain query parameters (uselang etc)
- $params = array_diff_key(
- $this->getRequest()->getQueryValues(), array( 'title' => null ) );
- $form->addHiddenField( 'redirectparams', wfArrayToCgi( $params ) );
-
$form->addPreText( $this->preText() );
$form->addPostText( $this->postText() );
$this->alterForm( $form );
+ if ( $form->getMethod() == 'post' ) {
+ // Retain query parameters (uselang etc) on POST requests
+ $params = array_diff_key(
+ $this->getRequest()->getQueryValues(), [ 'title' => null ] );
+ $form->addHiddenField( 'redirectparams', wfArrayToCgi( $params ) );
+ }
// Give hooks a chance to alter the form, adding extra fields or text etc
- Hooks::run( 'SpecialPageBeforeFormDisplay', array( $this->getName(), &$form ) );
+ Hooks::run( 'SpecialPageBeforeFormDisplay', [ $this->getName(), &$form ] );
return $form;
}
* Failures here must throw subclasses of ErrorPageError.
* @param User $user
* @throws UserBlockedError
- * @return bool True
*/
protected function checkExecutePermissions( User $user ) {
$this->checkPermissions();
if ( $this->requiresWrite() ) {
$this->checkReadOnly();
}
-
- return true;
}
/**