mAllowedRedirectParams = [ 'preloadtitle', 'nosummary', 'editintro', 'preload', 'preloadparams[]', 'summary' ]; } /** * @inheritDoc */ public function getRedirect( $subpage ) { if ( $subpage === null || $subpage === '' ) { return false; } $this->mAddedRedirectParams['title'] = $subpage; $this->mAddedRedirectParams['action'] = 'edit'; $this->mAddedRedirectParams['section'] = 'new'; return true; } protected function showNoRedirectPage() { $this->setHeaders(); $this->outputHeader(); $this->showForm(); } private function showForm() { $form = HTMLForm::factory( 'ooui', [ 'page' => [ 'type' => 'text', 'name' => 'page', 'label-message' => 'newsection-page', 'required' => true, ], ], $this->getContext(), 'newsection' ); $form->setSubmitTextMsg( 'newsection-submit' ); $form->setSubmitCallback( [ $this, 'onFormSubmit' ] ); $form->show(); } public function onFormSubmit( $formData ) { $title = $formData['page']; try { $page = Title::newFromTextThrow( $title ); } catch ( MalformedTitleException $e ) { return Status::newFatal( $e->getMessageObject() ); } $query = [ 'action' => 'edit', 'section' => 'new' ]; $url = $page->getFullUrlForRedirect( $query ); $this->getOutput()->redirect( $url ); } public function isListed() { return true; } protected function getGroupName() { return 'redirects'; } }