Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316704

Change subject: FormSpecialPage: Use DerivativeContext/setTitle trick
......................................................................

FormSpecialPage: Use DerivativeContext/setTitle trick

When constructing the HTMLForm instance, use a DerivativeContext that
has the title set to SpecialPage::getPageTitle(). This means that the
form will submit a post request against the root special page, and not
whatever subpage displayed the form.

Change-Id: I1ab90846f3d1f18586afa7469840821ccafa05f6
---
M includes/specialpage/FormSpecialPage.php
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/04/316704/1

diff --git a/includes/specialpage/FormSpecialPage.php 
b/includes/specialpage/FormSpecialPage.php
index c28c456..9b3fdcb 100644
--- a/includes/specialpage/FormSpecialPage.php
+++ b/includes/specialpage/FormSpecialPage.php
@@ -89,10 +89,12 @@
         * @return HTMLForm|null
         */
        protected function getForm() {
+               $context = new DerivativeContext( $this->getContext() );
+               $context->setTitle( $this->getPageTitle() );
                $form = HTMLForm::factory(
                        $this->getDisplayFormat(),
                        $this->getFormFields(),
-                       $this->getContext(),
+                       $context,
                        $this->getMessagePrefix()
                );
                $form->setSubmitCallback( [ $this, 'onSubmit' ] );

-- 
To view, visit https://gerrit.wikimedia.org/r/316704
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1ab90846f3d1f18586afa7469840821ccafa05f6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to